| Download MIF scripts | Browse source code | Read documentation |
| Version 0.9.1 | Last update: Wed Feb 26 15:00:02 GMT 2003 | |
MIF scripts
I made these scripts for a friend of mine, who's a technical author. Here's her documentation:
Prerequisites:
Perl installed (I have downloaded it from www.activestate.com/Products/ActivePerl). For other platforms, see CPAN.
Platform:
Any platform supported by Perl.
Limitations:
- You can only use tags to conditionally include paragraphs, not parts of paragraphs.
- You cannot use tags inside tables. You can use tags to conditionally include entire tables, though.
- Parts which are not marked are considered unconditional and will thus be included in all generated documents.
- With certain restrictions you can use FrameMaker conditional text in combination with the tags. These restrictions are:
- Except in tables, you can use FrameMaker conditional text to mark parts of paragraphs, not entire paragraphs.
- You can use FrameMaker conditional text in tables as normal.
Two Perl scripts:
1. check_codes.pl: Checks whether the tags are nested properly and whether the start and end tags match up in pairs.
2. split_mif.pl: Generates a separate MIF file for each of the tags.
Inserting tags in your FrameMaker document:
- There is no limitation on the number of tags, nor on the level of tag nesting. You can also choose the tag names freely, provided they are uppercase and contain only the letters A-Z.
- Tags must be in a separate paragraph. This means you can only use tags to conditionally include paragraphs, not parts of paragraphs.
- The tags must be nested properly.
Syntax for start of conditional paragraph: [[TA - TB - TC]] where TA, TB and TC are conditional tags. You must use [[ to start the paragraph and ]] to end the paragraph. This also means you cannot use [[ or ]] in the text of the document.
-
Syntax for end of conditional paragraph: [[$TA - TB - TC]] where TA, TB and TC are conditional tags. You must use [[$ to start the paragraph and ]] to end the paragraph. This also means you cannot use [[$ or ]] in the text of the document.
Example:
[[TA - TB]]
This bit applies to products TA and TB.
[[TA]]
This is only for product TA.
[[$TA]]
[[$TA - TB]]
To check the syntax of your document:
- Save the FrameMaker document as MIF in the same folder as the Perl script.
- Open the check_codes.pl script in a text editor.
- Enter the name of the MIF file as value for the variable 'my $inputfile'.
Example: To check the file 'User_Guide_Part3.mif', set the value of the variable
'my $inputfile' to 'User_Guide_Part3.mif':
(line 2 of the script, ignoring comments)
my $inputfile='User_Guide_Part3.mif'; - Save and close the script.
- Double-click the Perl script. The file 'check_MIF_codes_log.txt' will be generated.
- Open 'check_MIF_codes_log.txt' and check whether no syntax problems have been reported. If there are syntax problems, fix them in the FramMaker file and repeat steps 1 to 6. If there are no syntax problems, you can generate the product-specific documents.
To generate the product-specific documents:
- Open the split_mif.pl script in a text editor.
- Enter the name of the MIF file as value for the variable 'my $inputfile'.
Example:
To generate product-specific documents for the file 'User_Guide_Part3.mif', set the value of the variable 'my $inputfile' to 'User_Guide_Part3.mif':
(line 4 of the script, ignoring comments) - Enter the tags you have used as value for the variable 'my @codes'.
Example:
To generate documents for each of the tags TA, TB and TC, set the value of the variable 'my @codes' to 'TA TB TC': (line 2 of the script, ignoring comments)
my @codes= qw(TA TB TC); - Save and close the script.
- Double-click the Perl script.
The script will generate a MIF file for each of the tags.
Example:
User_Guide_Part3_TA.fm
User_Guide_Part3_TB.fm
User_Guide_Part3_TC.fm
my $inputfile='User_Guide_Part3.mif';
Note: This script has been written for a specific situation. If you would like the script to be extended, please contact me. If several people would find a feature useful, I'm willing to do further work on it.
