Text string in title case?

Rick Quatro frameexpert at truevine.net
Fri Feb 29 09:36:20 PST 2008


Hi Peter,

This is one of the strengths of MIF: that you can get an ASCII 
representation of your FM document and do manipulations like this. However, 
the advantage of FrameScript (and the FDK) is that you can work directly on 
the FrameMaker document (or book) without risk of corrupting the MIF file. 
FrameScript has built-in string functions as well as the ability to use 
regular expressions.

I recently did a TitleCase script that used an INI file for exceptions, both 
for acronyms that should stay uppercase and words that should be lowercase.

[Upper]
ADA=
II=
III=
IV=
HVAC=
TV=
XY=
UCLA=
ICU=
PA=
HUCLA=
USC=
LAC=

[Lower]
and=
to=

The script could be restricted to processing particular paragraph formats in 
order to limit its scope. Another useful feature is that each paragraph that 
is changed can be written to a hyperlinked log file. This would allow you to 
check what was actually changed, and to jump to a changed paragraph if 
necessary.

Depending on the scope of a problem, sometimes you have to fix things like 
this by hand. However, for anyone that uses FrameMaker on a near daily 
basis, FrameScript is definitely worthwhile to learn. I am amazed by how 
much people do "by hand" with FrameMaker.

Rick Quatro
Carmen Publishing
585-659-8267
www.frameexpert.com


> In the days of FM/unix, before book-wide search/replace and other
> come-lately power features, something like this would be done with
> fmbatch and one or more of GREP, AWK, and SED text-manipulation tools.
>
> The general plan was to use control fmbatch with a unix script to
> convert all appropriate .fm files to MIF, then perform the
> text-crunching on the MIF files, then reconvert the MIF files back to
> .fm with fmbatch.
>
> If there's enough volume to repay the effort, something similar would
> work today with mif2go from omsys.com, dobatch from cudspan, dzbatcher
> from datazone.com, or FM2MIF (a new free utility that installs under
> FM's File > Utilities menu option, from dtptools.com, to convert
> directories-full of .fm files to MIF). I believe mif2go's MIF
> converter is free; dobatch and dzbatcher are free. All but FM2MIF work
> like fmbatch.
>
> Instead of the unix tools, Perl or other newer text-manglers can do
> the find/replace, perhaps with the assistance of GREP.
>
> Converting .fm to MIF is the first step.
>
> The second step would be to find all the ALL CAPS titles in all the
> MIFs, collect them into a single-column list from which you can remove
> the duplicates, and create a second column with the precise conversion
> for each title - this would settle style issues over which title words
> to make all lowercase, etc.
>
> The third step would be to find and replace every instance of the
> uppercase titles with their title cased partner in the MIF, without
> damaging the MIF file's integrity. This may take some care in cases
> where the titles break across lines, etc.
>
> Finally, you'd use one of the fmbatch-replacements to reconstruct .fm
> files from the MIFs.
>
> I'm not a coder or scripter. Heck, my long-term and short-term memory
> aren't that good anymore. BUT, it's hard to forget a proven tool-chain
> process like this.<G>
>
> HTH
> Regards,
>
> Peter
> _______________________________
> Peter Gold
> KnowHow ProServices




More information about the framers mailing list