Skip navigation and move to Contents...
מקרא 2.0 כתבי הקודש מבארים את עצמם מקרא 2.0

How Is The Booklet Created?

As reported last week, preparation of The Word for 2016 is running. This evening a reminder to update the "Booklet to Print" popped up in my calendar.

The booklet features The Word for one month in two languages. Several times a year I create the booklets for some months in advance. I visited the download page - oh no, there are no booklets for August, and we already have July 13th!

So I decided to let The Word 2016 wait this evening and create the montly booklets for the rest of the year instead.

How does this work?

Everything is based on the .twd files which are freely available on our site. For a montly booklet like the one with English and German, I use an empty document in Open Document format (.odt). The document contains 4 pages: front, left, right, rear. A Perl script on my computer fetches the English and German .twd files for the month needed and mixes the sayings into the document.

Technically speaking, it extracts the content.xml contained in the .odt zip file and uses search/replace to fill the sayings into sections marked in the document, creating as many document pages as needed.

The re-ordering of the pages is a special challenge - so that you can use the printed A4 pages for an A5 booklet. It works like this:

  # Sequence of content page numbers for booklet of 4 sheets, front + rear, 4 content pages per sheet page.
  # Title page has page number 1.
  my @PAGESEQUENCE = $sequence ?  
    # front 1,2,3,4, rear 1,2,3,4
    (
      32,  1,  30,  3,
      28,  5,  26,  7,
      24,  9,  22, 11,
      20, 13,  18, 15,
       2, 31,   4, 29,
       6, 27,   8, 25,
      10, 23,  12, 21,
      14, 19,  16, 17,
    ) :
    # front 1, rear 1, ... front 4, rear 4
    (
      32,  1,  30,  3,    2, 31,   4, 29,
      28,  5,  26,  7,    6, 27,   8, 25,
      24,  9,  22, 11,   10, 23,  12, 21,
      20, 13,  18, 15,   14, 19,  16, 17,
    );
  my $nPaperPages = scalar(@PAGESEQUENCE);
  for (my $i = 0; $i < $nPaperPages; ++$i) {
     # $c== 0: $PAPERPAGES[ 0] = $CELLS[ 1]
     # $c== 1: $PAPERPAGES[ 1] = $CELLS[30]
     # $c== 5: $PAPERPAGES[ 5] = $CELLS[ 0]
     # $c==31: $PAPERPAGES[31] = $CELLS[14]
     # may leave some @PAPERPAGES undefined (at end of month)
     $PAPERPAGES[$i] = $ContentPages->[$PAGESEQUENCE[$i]-1];
  }

The Perl script creates files like en_de_TheWordMonthly_2015-08.odt. In a loop, I run the Perl script for the months August thru December 2015 with primary languages en,fr,he,pt,tr,zh-Hans,sw and secondary language en or de. In sum, it created 45 documents.

Now there is a complication: the sayings we publish are formatted with line-breaks for convenient reading. A basic rule is to have no text lines longer than 65 characters. But the booklet targets the A5 format, therefore some lines are still too long in the documents! Sometimes a single word is wrapped onto a new line, which does not look nice! So I review each document and correct overlong lines so that the line-breaks occur at places where they make sense with regard to the meaning of the saying.

Reviewing 45 documents with 30 or 31 sayings in two languages is a tedious task... Since the English and German sayings are used in multiple documents, paired with some other language, the Perl script can also - controlled by an XML file - automatically add line-breaks, and put an entire line in 10pt size instead of 10.5pt.

In the first review phase, therefore, I now record all changes in an XML file like:

<bible id="EnglishStandardVersion">
<small id="Gn4v26">At that time</small>
<wrap id="Gn18v19">children</wrap>
<wrap id="Gn18v19">Lord</wrap>

Then I run the script again, and in the contexts defined in the XML file, the script either adds a line-break (wrap) or decreases the font size (small). I still review the documents for remaining overlong lines, mainly in the respective other language. Then I generate a PDF document using LibreOffice.

Finally, I upload all PDF documents to our server, like

scp print/TheWordMonthly/*_TheWordMonthly_*.pdf  ftp...@bible2.net:www/download/TheWordMonthly/

Et voilà, success, the missing booklets for August are available:

Maybe you like to print or share one of them?

2015-07-13 • HSteeb • updated 2024-05-21