Turning styled text into tagged text
Posted: 2020-08-16 08:39:52
This one takes me back a long, long way....
Back in the NisusWriter Classic days, I created a macro that would convert a formatted document into a markup language (in this case, Quark XPress tags). The most important part of this process, and the one I don't know how to recreate, was reading the ruler name of a particular paragraph, putting an @ symbol at the front, and a colon at the end. So if I had a paragraph using the "normal" ruler, it would be something like this:
This is a paragraph that uses the "Normal" ruler. Otherwise, it's just text. But I want to put the ruler name at the beginning as a tag.
When the macro was run, it would produce this:
@Normal:This is a paragraph that uses the "Normal" ruler. Otherwise, it's just text. But I want to put the ruler name at the beginning as a tag.
I suddenly find I need to do this same operation. Obviously the old macro doesn't work.
But, more to the point, the method doesn't work, because NWP uses true paragraph style sheets rather than character styles and named rulers. (And I have checked, and the styles do not import properly into Quark XPress.)
Reading the macro manual, it is not clear to me how one determines the paragraph style of a particular paragraph. What I need is a macro that I would pseudocode as follows:
Any suggestions for how I get that elusive paragraph style tag?
Thanks for any ideas!
Back in the NisusWriter Classic days, I created a macro that would convert a formatted document into a markup language (in this case, Quark XPress tags). The most important part of this process, and the one I don't know how to recreate, was reading the ruler name of a particular paragraph, putting an @ symbol at the front, and a colon at the end. So if I had a paragraph using the "normal" ruler, it would be something like this:
This is a paragraph that uses the "Normal" ruler. Otherwise, it's just text. But I want to put the ruler name at the beginning as a tag.
When the macro was run, it would produce this:
@Normal:This is a paragraph that uses the "Normal" ruler. Otherwise, it's just text. But I want to put the ruler name at the beginning as a tag.
I suddenly find I need to do this same operation. Obviously the old macro doesn't work.

Reading the macro manual, it is not clear to me how one determines the paragraph style of a particular paragraph. What I need is a macro that I would pseudocode as follows:
Code: Select all
FOREACH $paragraph IN $Document
READ $paragraphStyleName
$ParagraphStyleTag = "@" & $ParagraphStyleName & ":"
PASTE $ParagrapgStyleTag at ThisParagraph.start
NEXT $paragraph
Thanks for any ideas!