FrameMaker MIF: replacing text in specific tags

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

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

FrameMaker MIF: replacing text in specific tags

Postby dgcuff » Fri Mar 20, 2009 1:56 am

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: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: FrameMaker MIF: replacing text in specific tags

Postby DataMystic Support » Fri Mar 20, 2009 9:30 am

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?
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

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

Re: FrameMaker MIF: replacing text in specific tags

Postby dgcuff » Tue Mar 24, 2009 1:37 am

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

Postby dgcuff » Tue Mar 24, 2009 3:51 am

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: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: FrameMaker MIF: replacing text in specific tags

Postby DataMystic Support » Tue Mar 24, 2009 6:13 am

Yes - the Title Case filter is pretty reliable!
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests