Macro for SwordSearcher to USFM

Get help using and writing Nisus Writer Pro macros.
User avatar
phspaelti
Posts: 889
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Macro for SwordSearcher to USFM

Post by phspaelti » 2013-05-02 02:01:20

Hi Eric,
check the last version (v5). I have changed things around, added comments, and added some formatting to make thing easier to read.
NisusUser wrote: The marker \p can be mid-verse – not necessarily at the beginning of the verse or at the beginning of the line. If it's mid-verse, it does not start on a new line. Then there is no new \v marker until the next verse.
In v5 I have separated the two cases, so you should be able to adjust the latter case to make it come out the way you want it.
NisusUser wrote: Re: \nd (names of diety). This is going to take some tweaking. That formatting should only be applied (best I can tell) if it is one isolated word in all caps. That's not foolproof, though, so I'll have to think this through. That's because in SS there is other text in all caps also – citations from the OT presented in the NT.
In v5 I have treated words in All-Caps of 3 letters or more as deity names. Again if you find a better rule you should be able to adjust it. Since those cases need to have their case change, dealing with them turned out be more complicated than a simple Find and Replace, but hopefully the way to deal with that should be clear enough from the code.

best
Philip
philip

NisusUser
Posts: 257
Joined: 2011-01-12 05:32:38

Re: Macro for SwordSearcher to USFM

Post by NisusUser » 2013-05-02 02:29:07

Philip,
Thanks again for all your work on this. Maybe you forgot to upload v5?
Eric

OOPS! How did I miss it? I just saw it. I'll try it out. Sorry.

NisusUser
Posts: 257
Joined: 2011-01-12 05:32:38

Re: Macro for SwordSearcher to USFM

Post by NisusUser » 2013-05-02 03:16:34

I commented out the \nd part from v5 for now. I'll have to study it out later.

I found a problem with the way the refences are added to the footnotes (e.g., "1:4" in the footnote in Gen 1:4). There needs to be an ending marker \ft so it is "\fr ch:v \ft" (where "ch" is chapter digit(s) and "v" is verse digit(s). Otherwise, USFM thinks the "fr" is just part of the footnote text.

User avatar
phspaelti
Posts: 889
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Macro for SwordSearcher to USFM

Post by phspaelti » 2013-05-02 03:50:40

NisusUser wrote:I found a problem with the way the refences are added to the footnotes (e.g., "1:4" in the footnote in Gen 1:4). There needs to be an ending marker \ft so it is "\fr ch:v \ft" (where "ch" is chapter digit(s) and "v" is verse digit(s). Otherwise, USFM thinks the "fr" is just part of the footnote text.
Okay I didn't read the specification carefully. You'll have to change the line:

Code: Select all

# Change footnotes to USFM format, including ‘chapter:verse’ marker 
  $txt.findAndReplace '{(.+?)}', "\\\\f + fr $c:$v \\1\\\\f*", 'Ea'
to

Code: Select all

# Change footnotes to USFM format, including ‘chapter:verse’ marker 
  $txt.findAndReplace '{(.+?)}', "\\\\f + fr $c:$v \\\\ft \\1\\\\f*", 'Ea'
[PS: I updated the file on the earlier message.]
philip

NisusUser
Posts: 257
Joined: 2011-01-12 05:32:38

Re: Macro for SwordSearcher to USFM

Post by NisusUser » 2013-05-02 11:04:14

Philip,
I can't thank you enough for your help. Version 5 is working great (except that I commented out the \nd, as I mentioned before). I hope (!) to come back to this next week, but until then I'll be busy with other things.

Unfortunately, I haven't yet reaped the benefits of your "didactic moment(s)", since you did all the work. I understand some of it – not a lot. Hopefully I'll be able to study this out sometime and learn to do my own macros like this. But it obviously is not for the faint-hearted, and I'm going to have to have my heart checked first :)

Thanks again & until next time,
Eric

Post Reply