PPTools/Ppgen/.bin files

From DPWiki
< PPTools‎ | Ppgen
Jump to navigation Jump to search

Ppgen 3.42 adds the ability for the PPer to have ppgen generate a Guiguts- and PPQT-compatible metadata (.bin) file for each output file that it creates. As many PPVers like to use Guiguts (or possibly PPQT) as part of the PPing and PPVing workflows, it may be beneficial for ppgen users to generate those files. Having them can save time for the PPVers, and make them more willing to PPV a project created by ppgen. (Most will probably PPV projects that do not have .bin files, but those that like them will be happier, and more productive, if they have them.)

Ppgen 3.51f added the ability to additionally create the newer format of metadata file required by PPQT2. To get that style of metadata file, in addition to the Guiguts-style .bin file, add the -ppqt2 option to the command that invokes ppgen.

Ppgen will create the .bin file(s) if it finds any .bn commands in the -src.txt file. So, if you want to get .bin files you'll need to add the .bn commands, generally one per proofing image provided by the Project Manager. This is simple to do if you have a text editor that supports search/replace using regular expressions. When you begin work on the project you receive a text file where each original page (proofing image) of the project is indicated by a header line in the text file.

Example:

-----File: a001.png---\P1 proofer\P2 proofer\P3 proofer\F1 formatter\F2 formatter\------------
Text from proofing image a001.png
-----File: a002.png---\P1 proofer\P2 proofer\P3 proofer\F1 formatter\F2 formatter\------------ 
Text from proofing image a002.png
etc.

A typical ppgen workflow before this has had, as one of the initial steps, either removing or (preferred) converting those header lines to comments, such as

// a001.png

That helps you, as the PPer, by letting you figure out where in the project some piece of text came from while you're working. But that would not help the PPVer because the PPVer does not see your source files, and because Guiguts and PPQT do not know how to interpret those comment lines even if the PPVer did have the file. That's where the .bn commands come in.

You probably used a regular expression (regex) search/replace like this one to turn the headers into comments:

 Search: -----File: (\w+\.png)-.*
Replace: // $1

or possibly (depending on the editor and what regex syntax it supports)

 Search: -----File: (\w+\.png)-.*
Replace: // \1

If you wanted to turn the headers into .bn commands, you would simply change the replacement term. Instead of

Replace: // $1

you would use

Replace: .bn $1

Or, if you wanted both the .bn and a comment you might use

Replace: .bn $1 // $1

to get

.bn a001.png // a001.png

Or you could use a more complex replacement expression to get those on separate lines:

Replace: // $1\n.bn $1

where the "\n" would place the .bn on a new line following the comment, giving you

// a001.png
.bn a001.png 

Note: In some editors, such as Notepad++ on Windows you might need to use \r\n instead of simply using \n.

Perhaps you have been using a workflow where you turn the headers into both a comment and a .pn command to set a page number that can display in the HTML, or be used for links from one part of the book to another. A typical search/replace regex for that might be:

 Search: -----File: (\w+\.png)-.*
Replace: // $1\n.pn +1

If you wanted to do that, and have .bn commands, too, you could use this instead:

 Search: -----File: (\w+\.png)-.*
Replace: // $1\n.pn +1\n.bn $1

or

 Replace: // $1\n.bn $1\n.pn +1

It really does not matter what order you have the .bn and .pn, as they perform different and unrelated functions. If you use the one with .pn before .bn you'll get

// a001.png
.pn +1
.bn a001.png

Note that the use of .bn will not change your output files (projectname-utf8.txt, projectname-lat1.txt, projectname.html) in any way. All of the data is placed into the corresponding .bin file (projectname-utf8.txt.bin, projectname-lat1.txt.bin, projectname.html.bin).

When you're ready to upload your project for PPV, simply choose the set of output files you want to use, and their corresponding .bin files, and put them (and your images directory, if any) into the .zip file that you upload.

The .bin file is a standard text file that you can open with any text editor. However, you should not change its contents unless you understand the data format or it might not work any more in Guiguts or PPQT.