Contents items import


#1

I have a large book (non-Scripture) in Paratext that I want to make a book out of with RAB. It has over 100 chapters (with \c marker) and I want to add each chapter’s title (\ms) as an item in the app’s TOC. I have these chapter titles in a Word document. Is there a way to import this list of chapter titles to the TOC or do I have to add them one by one? There is an “Import” button on the RAB Contents Menu screen. It wants a ZIP file but I don’t know what exactly should be in the file.


#2

The zip file that it accepts contains a contents.xml file and a folder containing any images.
If you put in a few entries then do an export you can then unzip the output and see what it looks like.

It is then up to you to decide if you can write a script to create a similar file. I’d use XSLT2.

If you look at the code below.

<contents>
      <title lang="default">Kriol test 2</title>
      <feature name="show-titles" value="true"/>
      <feature name="show-subtitles" value="true"/>
      <feature name="show-references" value="false"/>
      <feature name="launch-action" value="contents"/>
      <contents-items>
            <contents-item id="1">
                  <title lang="default">Home TOC</title>
                  <link type="screen" target="1"/>
            </contents-item>
            <!-- Repeat the four line section below -->
            <contents-item id="2">
                  <title lang="default">First title</title>
                  <link type="reference" target="TID.1"/>
            </contents-item>
            <!-- End of the four line repeat section -->
      </contents-items>
      <contents-screens>
            <contents-screen id="1">
                  <title lang="default">Home</title>
                  <items>
                        <!-- Repeat the line below and increment the number to match contents-item id above -->
                        <item id="2"/>
                        <!--  end of repeat line -->
                  </items>
            </contents-screen>
      </contents-screens>
</contents>

For each additional title after First title you need to repeat the four lines I have surrounded by comments shown in grey.

<contents-item id="3">
          <title lang="default">Second title</title>
         <link type="reference" target="TID.2"/>
</contents-item>
  • increment the id="3" number

  • change the title

  • change the target="TID.1"

    Note the TID part is the book abbreviation code. This needs to be changed to suit your book. The number is the chapter.

Then the <item id="2"/> needs to be repeated for each item added at the top.
<item id="3"/>

Note the number refers to the id of the contents-item. Hence it starts a 2.

You can add more screens and link screen to screen. But that gets just a little more complicated.