FrameMaker MIF: replacing text in specific tags

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
dgcuff
Posts: 4
Joined: Fri Mar 20, 2009 1:43 am

FrameMaker MIF: replacing text in specific tags

Post by dgcuff »

I'm not even sure I can accomplish what I need to in TextPipe Lite... it may be time to upgrade.

I want to change the text that appears in multiple tags. For example, I have tags "Heading 1", "Heading 2", "Chapter Title", and "Figure Caption". I want all the text in these tags to appear in sentence case.

(Except, of course, there are proper nouns I want to exclude, but one problem at a time.)

After spending some time look at how FrameMaker stores information in MIF files, I'm stumped:

Code: Select all

 <Para 
  <Unique 1088218>
  <PgfTag `Heading2'>
  <ParaLine 
   <String `Big Fjords vex Quick Waltz Nymph'>
  > # end of ParaLine
 > # end of Para
If the exact same String appears inside a different PgfTag, I want to leave it alone. However, whenever any string appears with any of the PgfTags that I listed above, I want to alter the text.

This would be so much easier if <PgfTag ended with /PgfTag>.

Anyone have any hints?
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: FrameMaker MIF: replacing text in specific tags

Post by DataMystic Support »

You need to use nested search/replaces here.

First,

<PgfTag `(Heading2|Heading1|ChapterTitle|FigureCaption)'>\s*<ParaLine\s*<String `(.*)'>

Replace with $0 - ensure Prompt On replace is on.

INSIDE this filter, add a new search replace for
<String `(.*)'>
Action- send $1 to subfilter.

INSIDE this filter, add Title Case as a subfilter. Does that make sense?
dgcuff
Posts: 4
Joined: Fri Mar 20, 2009 1:43 am

Re: FrameMaker MIF: replacing text in specific tags

Post by dgcuff »

DataMystic Support wrote:INSIDE this filter, add Title Case as a subfilter. Does that make sense?
Thanks, the subfilter approach makes perfect sense (that much I'd figured out), but your implementation gets around a bunch of things that had me scratching my head. And you've also answered my question: since TextPipe Lite doesn't include Title Case options, I need to trade up!
dgcuff
Posts: 4
Joined: Fri Mar 20, 2009 1:43 am

Re: FrameMaker MIF: replacing text in specific tags

Post by dgcuff »

Incidentally, for the benefit of any FrameMaker users reading, I had to make a couple of changes to the top-level filter to deal with optional text:

Code: Select all

<PgfTag `(Heading2|Heading1|ChapterTitle)'>(|\s*<PgfReferenced Yes>)\s*<ParaLine(|\s*<TextRectID \d{1,4}>)\s*<String `(.*)'>
Also, for the table and figure captions (which I chose to handle in a completely separate filter), the top level has slightly different text to contend with:

Code: Select all

<PgfTag `(FigureCaption|TableTitle)'>\s*<PgfNumString `(Figure|Table)\\x11 \d{1,3}-\d{1,3}\\t'>\s*<ParaLine\s*<String `(.*)'>
These two top-level filters were tested against my sample MIF file, so they are certainly practical to that extent. I haven't been able to test the Title Case option of TextPipe, but I think we can assume that will work.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: FrameMaker MIF: replacing text in specific tags

Post by DataMystic Support »

Yes - the Title Case filter is pretty reliable!
Post Reply