TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Need guidance on scripting program code into FrameMaker
Subject:Need guidance on scripting program code into FrameMaker From:"Guy K. Haas" <ghaas -at- selectica -dot- com> To:TECHWR-L <techwr-l -at- lists -dot- raycomm -dot- com> Date:Thu, 02 Mar 2000 13:16:00 -0800
O TECHWR-L gurus--
I'm working in a WinNT environment.
I have a corpus of code chunks that I want to import into a
FrameMaker doc -- a reference manual about an API.
These chunks are sample/example code, and the developers are
fiddling with them actively. I want to be able to snatch them
up and publish them every few weeks without a lot of handwork.
What kind of handwork?
I want to
-replace any initial tabs with a set of 4 spaces, then
replace any set of 4 initial spaces with a tab,
-omit lines that contain a certain text
-have each file come in as a single FrameMaker paragraph,
not a paragraph per incoming line.
There are other operations I MIGHT want to automate, but those
three are the basics.
I'd like to do this with Perl, not some FrameMaker tool that I'd have
to buy.
It would be possible to have the FrameMaker chapter include
each of the massaged files by reference rather than by copying.
I'd like do to it simply, not in a way that requires MIF files.
I have not found a way, in Perl, to get a series of lines
to import as one paragraph, no matter what choices I make
in the Import Text File by Copy dialog:
o Merge Lines into Paragraphs
(Blank lines are paragraph breaks.)
o Treat Each Line as a Paragraph
o Convert Text to Table
The first one looks like what I want to do, but when I
use Perl to replace the "newline" or even "\0D\0A" (CR/LF)
with a \f (formfeed) or \r (return), and use the first option,
I still get one paragraph per line when I import.
Who can give me a clue about how to pull this off?
Thanks,
Guy K. Haas
Senior Technical Writer
Selectica, Inc.
E-Mail: ghaas -at- selectica -dot- com
Internet: www.selectica.com
Phone: (408) 545-2514 Fax: (408) 570-2167