App created from multiple Bible Modules

I’m looking to create an app (“Lives of the Prophets”) which takes about 16 different Bible Modules and combines them into a single app. As far as I can tell, SAB isn’t really set up to deal with Bible Modules at all. Is that correct? Would there be any advantage to using RAB, or will it have the same problems?

Has anyone ever done this? Is there a write-up of best practices on how to do this?

I’ve done this in the past, but for less complex arrangements of texts. In those old apps I created Python scripts which:

  1. Took the output module from the PT directory (e.g. 96XXCABC.SFM), applied some regex changes like adding \c markers and numbers whenever a \s section title occurred, and then saved the new file into the SAB directory structure (the “source” location in SAB, I think).
  2. Read that file and created a contents.xml file for SAB based on \s names and making the target the chapter number.

Obviously #2 could have been done within SAB, but that would have required hand-editing if anyone ever created or edited the \s markers in PT.

But now, with a large project, I’m running into some problems. The biggest is that I have more modules that PT can handle at once. I can load the spec files in PT and then deal with up to 7 output files at a time (XXA-XXG), but I can’t do them all at once. Can SAB read the spec file directly, or can it only handle the output files? Is there a command line way to take the spec file and create an output file, like what PT does internally when you load a Bible Module into one of the XXA-G books?

Does SAB have any way to build a ToC itself based on some simple rules, or is the assumption that you do it by hand, even if it involves potentially hundreds of entries? If it can do it automatically, can it handle something like "for each separate Bible Module, create a main ToC which points to a new “screen”, and then “for each section title, create an item in that screen that points to the title’s chapter”?

1 Like

SAB can’t read the Bible module spec files.

Paratext has a command line tool that can write and read books into Paratext. Don’t have PT running to be safe.

rdwrtp8 -w PROJ XXA 0 "D:\My-Modules\module1.sfm"

You can then export that.

rdwrtp8 -r PROJ XXA 0 "D:\My-Expanded-Modules\module1.sfm"

The exported form has everything filled in. You can use the same write to overwrite the previous XXA book with a different module.

I am surprised that worked. I’m glad I tested it.

Once you export the USFM files you would need to change the ID of the 8th and following created books. As long as it does not overlap with a known books ID it should be fine. I.e. M01, M02 etc.

I have used scripts to generate quite complex Content Menu from the source data. So I’d use the Contents Menu as the ToC but it could be a page with links.

SAB could add in \c before each \s but it is not able to number them. That is a scripting job.

Sadly I can’t get that to work. Although it does copy the file from one location to another, it doesn’t appear to do anything at all other than add an \id line at the beginning of the file.

In particular, when I use rdwrtp8 -w, the file at 94XXAPROJ.SFM is just the spec file with an \id line. It’s not filled in. And when I use rdwrtp8 -r it still doesn’t get filled in with the module output.

Even more oddly, when I use rdwrtp8 -w and then open PT, it still thinks the original module is in XXA. In other words, PT hasn’t been informed that I tried to move a new module into XXA. So it seems like rdwrtp8 -w is doing nothing other than copying the file and adding one line.

I’m getting an error message from rdwrtp8 every time which says Missing Localizer implementation. English text will be used instead.. But I’m assuming that’s not affecting things.

Firstly you must have the scripture text in the project for the export to have the scripture text added. My test only had NT but not OT so all lines like:

\s $(GEN 1:1,31)
\ref GEN 1:1,31

change to

\s Start 1:1,31

Whereas for NT:

\s $(JHN 1:3)
\ref JHN 1:3

got expanded to:

\s John 1:3 
\p God wen make eryting, wid dis Guy God make eryting. No mo notting dis Guy neva make.

Did you change PROJ to your project name?

As an alternative you can create add the module then export USX and take the XXA USX file and use that in SAB.

I’ve created an environment path in Windows to the PT program directory so that I can use rdwrtp8.exe directly. I’m using the version packaged with PT9.2/9.3, but I’ve tried the (different) version that comes with PT8 with no difference, and I’ve tried using full path names with all the directories in the commands.

I’ve created a minimal module with the lines

\rem Bible Module test.sfm
\inc v f s
\ref JHN 1:1

and I’ve experiemented using all 3 lines, just the 1st and 3rd, just the 2nd and 3rd, just the 3rd, and the 3rd but using lower case (Jhn). None of them worked.

The commands I’m using are
rdwrtp8 -w zEngTest XXA 0 test.sfm and
rdwrtp8 -r zEngTest XXA 0 output.sfm
I’ve also tried the -r line adding the -x and -xe flags, and while they result in xml output, they still don’t fill in the verse test.

I’ve also tried this in 4 different projects.

Can you see anything in the above which I’m doing wrong?

That looks correct to me.

Since it’s not working on my machine, is my best option now to ask for help on the Paratext supporters site? Or is there some other way for me to figure out what’s wrong?

Sure always happy to recommend you ask some other support system.

According to the PT developers, rdwrtp8.exe won’t actually do what we’re attempting.

However, it dawned on me that ptxprint will. I haven’t written the actual script yet, but when I do I’ll use the a command line instruction like
"C:\Program Files\PTXprint\PTXprint.exe" -c ConfigName -M *Module* -P ProjID

ConfigName and ProjID need to be changed to fit your context, and *Module* would be the name of the module spec file, probably including the path to it.

The final result will be a pdf, but a byproduct will be the expanded module (the file will have “flat” in it’s name). It will be located at:
..\My Paratext 8 Projects\ProjID\local\ptxprint\ConfigName

Well I don’t know why mine did work and yours didn’t.

But a good workaround. @mjpenny will be pleased by or the contribution of PTXprint.