sillsdev / ptx2pdf

XeTeX based macro package for typesetting USFM formatted (Paratext output) scripture files
21 stars 7 forks source link

Vertical Bar | 0x07C in footnote throws error in PTXPrint 2.4.7 (Windows) #937

Open philipmarkreid opened 6 months ago

philipmarkreid commented 6 months ago

This took me a long time to figure out. I used the vertical bar | 0x007C to delineate between poetic lines in an alternative rendering of a verse which has text critical issues. This seems to be the standard way of delineation in a footnote. \q2 o laaɓinan leydi yimɓe makko\f + \fr 32:43 \ft Ayaare ndee na winndiraa ley dewte goɗɗe: \fqa Lenyi goɗɗi kellana yimɓe makko | sabo o yoɓtanto ƴiiƴam gollanooɓe mo, | o hiitoto wayɓe makko, | o laaɓinan leydi yimɓe makko. \f*.

PTXprint threw this error - which I managed to eliminate by replacing 0x007C with back slash 0x002F. Retraining 0x007C vertical bar would be ideal.

Mailto: ptxprint_support@<your.org's.address> PTXprint [2.4.7] - Error! Failed to create: BKFPrint_Default_DEU_ptxp.pdf ! Use of \startn@testyle doesn't match its definition. \don@testyle ...se \let \n@xt \startn@testyle \fi \n@xt

... / o laaɓinan leydi yimɓe makko. \f *. \b \p \v 44 Muusaa e Yo... \@@@attr@grab-fqa ...ef \@ttributes {\noexpand {#1 }}\trace {A}{\gr@bname :fo... l.1682 ...ɗon \ft ley Ibraninkoore na winndaa \fqa O jooɗoo hakkunde balaaje... ------------------------------------------------------------------------------------------ Oops! Something unexpected happened causing this unhandled error. Try using the 'Tidy Up' button on the Help tab and then try again. If you are still unable to proceed, use the 'Create Archive...' button on the Help tab to create a .zip file. Send it to your PTXprint support person for further assistance. Please include a description of the problem, and if known, state which setting was changed since it last worked. PTXprint Version 2.4.7
mhosken commented 6 months ago

Since | delineates attributes in a character style, it is now considered a special character in USFM, much like ~ but with a very different function. Therefore, if you want a | in you output, you will need to escape it thus \|.

On Fri, 22 Dec 2023, 16:54 philipmarkreid, @.***> wrote:

This took me a long time to figure out. I used the vertical bar | 0x007C to delineate between poetic lines in an alternative rendering of a verse which has text critical issues. This seems to be the standard way of delineation in a footnote. \q2 o laaɓinan leydi yimɓe makko\f + \fr 32:43 \ft Ayaare ndee na winndiraa ley dewte goɗɗe: \fqa Lenyi goɗɗi kellana yimɓe makko | sabo o yoɓtanto ƴiiƴam gollanooɓe mo, | o hiitoto wayɓe makko, | o laaɓinan leydi yimɓe makko. \f*.

PTXprint threw this error - which I managed to eliminate by replacing 0x007C with back slash 0x002F. Retraining 0x007C vertical bar would be ideal. Mailto: ptxprint_support@<your.org's.address> PTXprint [2.4.7] - Error! Failed to create: BKFPrint_Default_DEU_ptxp.pdf ! Use of @. doesn't match its definition. @. ...se \let @. @. \fi @. ... / o laaɓinan leydi yimɓe makko. \f . \b \p \v 44 Muusaa e Yo... @@@attr **@. ...ef @ttributes {\noexpand {#1 https://github.com/sillsdev/ptx2pdf/issues/1 }}\trace @. :fo... l.1682 ...ɗon \ft ley Ibraninkoore na winndaa \fqa O jooɗoo hakkunde balaaje...

Oops! Something unexpected happened causing this unhandled error. Try using the 'Tidy Up' button on the Help tab and then try again. If you are still unable to proceed, use the 'Create Archive...' button on the Help tab to create a .zip file. Send it to your PTXprint support person for further assistance. Please include a description of the problem, and if known, state which setting was changed since it last worked. PTXprint Version 2.4.7

— Reply to this email directly, view it on GitHub https://github.com/sillsdev/ptx2pdf/issues/937, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLMO3N4WMZ44PPW3KNIW6LYKW3LPAVCNFSM6AAAAABBABSDCSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TIMRQGUZDENY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

philipmarkreid commented 6 months ago

Thanks Martin

It’s interesting that Paratext 9.4 is not flagging this as an error. I only figured it out by selectively deleting chapter by chapter until I got to the verse in question.

[Edit: removed email chain]

davidg-sil commented 6 months ago

Yes, sadly Paratext objects to some things that are standards-compliant USFM (and which it'll even render properly, in some modes!), and does not warn about some things that are not standards-compliant.

However, with some clever python, this particular error type could be spotted by PTXprint, and a warning given or auto-correct applied, maybe?? -

\foo text | attribute="value"\foo* is valid, as is \foo text|something\foo* but \foo text |something [but no \foo*] is not. I don't know if this would go in the parser or where, exactly... I don't speak python well enough. @mhosken, would you like to comment / implement?

mhosken commented 6 months ago

It might be possible to do this with a regex change. But I will warn up front it is also probably easier to just make the edit to conform to USFM. I wouldn't be too hard on PT 9:4, this aspect of the standard was resolved after PT 9.4. Trying to write a regexp that does a negative match on a capture group off the top of my head, is beyond me today. Make the edit and feel smug for the future!

On Mon, 8 Jan 2024, 16:04 davidg-sil, @.***> wrote:

Yes, sadly Paratext objects to some things that are standards-compliant USFM (and which it'll even render properly, in some modes!), and does not warn about some things that are not standards-compliant.

However, with some clever python, this particular error type could be spotted by PTXprint, and a warning given or auto-correct applied, maybe?? -

\foo text | attribute="value"\foo is valid, as is \foo text|something\foo but \foo text |something [but no \foo*] is not. I don't know if this would go in the parser or where, exactly... I don't speak python well enough. @mhosken https://github.com/mhosken, would you like to comment / implement?

— Reply to this email directly, view it on GitHub https://github.com/sillsdev/ptx2pdf/issues/937#issuecomment-1881365851, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLMO3KQ4POLMA4OTENWMIDYNQKKVAVCNFSM6AAAAABBABSDCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGM3DKOBVGE . You are receiving this because you were mentioned.Message ID: @.***>