Tim Maher
yumpy(AT)cpan.org
tim(AT)TeachMePerl dot com
mg2mgp - Preprocessor for ``Magicpoint'' presentation viewer
v0.02
The latest documentation on this module is always available at http://teachmeperl.com/mg2mgp.html.
At the present time, due to numerous complications introduced by the (buggy) release of Magicpoint 1.10a, this program has not yet had its first general release. Watch for updates on its status at http://teachmeperl.com/mg2mgp.html.
First convert the *.mg file to *.mgp using:
mg2mgp presentation.mg > presentation.mgp
Then run Magicpoint on the *.mgp file as usual:
mgp presentation.mgp
Magicpoint (http://www.mew.org/mgp) is great, and free, and open source, all of which are wonderful properties. But for people who do lots of text markup, it's cumbersome to use. This program alleviates that problem.
The mg2mgp program is entirely self-contained, for the benefit of those running Magicpoint who have or can get Perl but don't want to learn now to download lots of CPAN modules (we don't need no stinking modules!).
It consists entirely of Perl, which is a great language, and I recommend you learn it ASAP, by taking a class from me as thousands of other happy and successful people have done (see http://teachmeperl.com/recent_evals.html).
The mg2mgp program lets you create a Magicpoint presentation much more easily, and with the option of using many powerful new features.
For instance, consider a page whose basic design is described in the first section below. It's created by storing in a *.mg file the required text, Magicpoint directives, and special mg2mgp tags, shown in the second section. This file is then processed by mg2mgp to create the *.mgp file, shown in the third section, that tells Magicpoint how to lay out the page.
The *.mg file to describe the page only requires 532 characters, but the associated *.mgp file for Magicpoint's use takes 1221! Somebody has to do 130% more work; why should it be you?
Please examine the image of this page, to get the full appreciation for how many stylistic changes are involved, and how nice the result looks. It's available at http://teachmeperl.com/Page1.jpg, or reproduced below, if the your document format supports images.
You may click the image to make it larger.
Title Sub-title Part II in series
<IMAGE HERE>
Author URL of Company Web-Site Email address Phone Number Date of Printing
Complication: I want lots of color and font changes on this page!
Here's the .mg file that creates the above page, complete (and replete) with color and font changes, as well as other formatting conveniences that aren't provided by Magicpoint itself. (Described below).
NOTE: As detailed in Sample .mg2mgprc file, style codes starting with C_, F_, and S_ are respectively for color, font, and size changes. The user can also use the actual color-names (e.g., mediumseagreen), if desired, but many will prefer abbreviations for frequently used names. <TITLE>, <SUBTITLE>, <PARTS_TITLE>, <PARTS_TEXT>, and other bracketed words that aren't colors, fonts, or size requests, are user-defined styles, described below.
%include "/Speeches/timji.mgprc" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tpage% %center %size 8.5 %vgap 25 <TITLE><C_TO>Minimal Perl <SUBTITLE><C_GR>for <C_GRE>Shell Users <C_GR> and <C_HP>Shell Programmers<C_W> evgap% <PARTS_TITLE>Part II: %cont <PARTS_TEXT>Scripts that beat <cyan>grep<C_GR>, %cont <cyan> sed<C_GR>, and <cyan>awk<C_W> hvgap% hvgap% %newimage -xscrzoom 18 "/Speeches/images/cont1b.jpg" hvgap% hvgap% %vgap 30 include% "sig.mg2" %fore "snow", size 3 %center command% date +%D %cont Printing
You may have thought the *.mg file looked complicated, but here's what you would have had to type on your own (excluding comments) to get the same result directly with Magicpoint.
%include "/Speeches/timji.mgprc" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %center, fore "lightgray", size 9.5 %center %size 8.5 %vgap 25 %font "expb", size 11.5 %fore "tomato" Minimal Perl %font "expb", size 7 %fore "gray" for %fore "green" %cont Shell Users %fore "gray" %cont and %fore "hotpink" %cont Shell Programmers %fore "white" %size 2 %size 5 %size 0.175 %font "thick", fore "lightgray", size 6.6 Part II: %cont %font "thick", fore "gray", size 5.3 Scripts that beat %fore "#00FFFF" %cont grep %fore "gray" %cont , %cont %fore "#00FFFF" sed %fore "gray" %cont , and %fore "#00FFFF" %cont awk %fore "white" %size 0.7 %size 5 %size 0.7 %size 5 %newimage -xscrzoom 18 "/Speeches/images/cont1b.jpg" %size 0.7 %size 5 %size 0.7 %size 5 %vgap 30 %fore "lightgray" %center, font "bold", size 6.0, fore "orange", fore "lightgreen" Tim Maher %font "thick", size 7, fore "gold" %size 5, fore "yellow2" %size 0.35 %size 5 %vgap 30 www.TeachMePerl.com tim %fore "#BEBEBE" %cont (AT) %fore "#FFD700" %cont TeachMePerl.com %fore "white" %size 5, fore "lightgoldenrod" (866) DOC-Perl %fore "snow", size 3 %center 08/09/03 %cont Printing
Here's another sample page, that shows off some of the source-code oriented features of mg2mgp, including its ability to render comments differently.
Here's the *.mg file, of 682 bytes:
%include "/Speeches/timji.mgprc" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% npage% %center Data Validation check_pcode %leftfill evgap% # code% /bin/cat check_pcode.plx 10:50:5.1 <XMP> <$> <CODE2> check_pcode directory<OUTPUT2> Bad code on line #3: 698107 hvgap% hvgap% <BAR> evgap% # Spread-out coding style, needs manual %cont <CODE_SNIP> $pcode =~ /<F_BI>RE<F_CB>/ %cont <SNIP_EXP> %cont match <F_BI>RE<B_2> against<C_G> $pcode # # Single-line coding style; automatic %cont <CODE_SNIP> ^\d\d\d\d\d$ <SNIP_EXP> exactly five digits # <CODE_SNIP> $. <SNIP_EXP> number of current input line # Coming soon: TABLES, to automatically align columns
And here's the corresponding *.mgp file, of 1,918 bytes:
%include "/Speeches/timji.mgprc"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
###########################################
# NOTE: Formatted for Magicpoint >= 1.10a #
###########################################
%page
%center
%fore "white"
(C) 2003, Tim Maher 0-1 www.TeachMePerl.com
%center
Data Validation
check_pcode
%leftfill
%size 2.5
%size 5
%size 0.175
%size 5
#
%vgap 33
%fore "white"
%font "tty"
%size 5.1
%left
%fore "yellow"
\#! /usr/bin/perl -wlnaF:
%fore "white"
%size 1
%size 5.1
%vgap 33
( $N , $pcode ) = @F;
%cont
%fore "yellow"
\# $N contains Name
%fore "white"
unless ( $pcode =~ /^\d\d\d\d\d$/ ) {
%cont
%fore "yellow"
\# Correct Format: Fred Morris:98117
%fore "white"
warn "Bad code on line
%cont
%fore "yellow"
\#$.: $pcode";
%fore "white"
}
%font "default"
%font "title", size 6, center, fore "sandybrown"
Examples
%leftfill, font "default", fore "white"
%leftfill, size 6, fore "lightsteelblue", font "tty"
$
%cont
%leftfill, size 5.0, fore "white", font "courierb"
check_pcode directory
%leftfill, size 5.0, fore "lightgray", font "tty"
Bad code on line #3: 698107
%size 0.7
%size 5
%size 0.7
%size 5
%vgap 20, bar "gray" 10 15 70, cont
%size 0.175
%size 5
# Spread-out coding style, needs manual %cont
%leftfill, size 5, fore "gold", font "courierb"
$pcode =~ /
%font "bolditalic"
%cont
RE
%font "cb"
%cont
/
%cont
%leftfill, size 4.5, fore "white", font "bull2"
%cont
match
%font "bolditalic"
%cont
RE
%tfont "verdana.ttf", size 5.0, fore "pink", vgap 75, cont
%cont
against
%fore "gold"
%cont
$pcode
#
# Single-line coding style; automatic %cont
%leftfill, size 5, fore "gold", font "courierb"
^\d\d\d\d\d$
%leftfill, size 4.5, fore "white", font "bull2"
%cont
exactly five digits
#
%leftfill, size 5, fore "gold", font "courierb"
$.
%leftfill, size 4.5, fore "white", font "bull2"
%cont
number of current input line
# Coming soon: TABLES, to automatically align columns
mg2mgp takes a file-name like presentation.mg as an argument, and writes output for a presentation.mgp file, for viewing with Magicpoint (see http://www.mew.org/mgp).
The purpose of this project is to make it MUCH easier for the user to prepare magicpoint presentations. One major function of this program is to provide a configurable preprocessor, that allows user-defined styles to be easily applied to text. This is accomplished by placing style definitions in the .mg2mgprc configuration file.
Other features make it easier to acquire and prepare text obtained from operating system commands, and control how it's displayed.
For example,
recursive file inclusion is provided by the include% directive,
line exclusion is provided by skip%/unskip%,
special formatting of
computer programs is provided by the code% directive,
and execution of arbitrary commands and collection of their output is
provided by command%.
In addition,
tpage% provides support for sections started by ``title pages'', and npage% for
pages within those sections, with
(adjustable) default styles in effect and
automatic two-part page numbering in the heading.
The following
To make it easier to proofread demonstrations, %pause directives can be filtered out using the command mgp_nopause, so each page can be viewed in one glance.
The program contains many subroutines. Those that start with the prefix ``mgp_'' are Magicpoint-specific. The others (include, skip, code_command, etc.) are of general text-processing applicability (and I'm using them in other projects, such as my POD pre-processor).
Ultimately, this body of software will be distributed on the CPAN (www.cpan.org), probably under the name Magicpoint::Preprocessor. This is a preliminary version that is implemented as a single Perl script, that can be invoked under the following names (if it's multiply linked on installation):
skip, include, po2pod, process_command, process_code, mgp_force_gaps, add_newlines, mgp_nopause, mg2mgp
Most importantly, the mg2mgp invocation implements the following cascading filter, so you don't have to go to all the trouble of indenting those lines correctly yourself: 8-}
<INPUT_HERE>
include
skip
code_command
mgp_rm_comment
mgp_pages
mgp_styles
mgp_tinygap
mgp_nopause
mgp_force_gaps
add_newlines
mgp_squeeze_gaps
<OUTPUT HERE>
One major function of this program is to provide a configurable preprocessor, that allows user-defined styles to be easily applied. This is accomplished by placing style definitions in the .mg2mgprc configuration file.
For example, the following is a style definition of the color-changing (C_) variety, for switching to gold text:
C_G %fore "gold"
A style definition of the alignment (A_C) variety, for line centering, follows below. It is different, because in addition to specifying how to apply the style (on the first line after the style name), it also shows what style to change to afterwards (on the second following line).
A_C %center %leftfill
This facility is needed because there's no easy way to really undo a style change, because only Magicpoint is fully aware of the current settings -- and it's not telling!)
A style tag consists of angled-brackets, enclosing a predefined style name, and optionally the text to be rendered in that style.
For example,
in the mgp view, all words will be <C_G>golden from here on
To request the automatic application of the ``undo'' style, you can embed the text to be rendered within the style directive, so long as you have provided the undo line in the definition.
(NOTE: This style usage is not quite mature; in particular, there's a problem with extraneous blank lines appearing when two or more appear in a row; I'll fix this later.)
For example, given the style definition for centering shown above, you'll get the results shown below.
<A_C These words are centered> and these will be on a separate line, left-filled. And all following lines will be left-filled, until some other directive changes that situation
These words are centered
and these will be on a separate line, left-filled. And all
following lines will be left-filled, until some subsequent
directive changes that situation
See the configuration file documentation for complete information on defining your own variables, for use in style definitions.
The mg2mgp program implements several directives, that enhance or extend those provided already by Magicpoint.
Unlike style definitions, directives don't have undo information, because their job is not to change, and then (optionally) change again (for ``undoing''), display parameters. Instead, they filter, collect, generate, or reformat text, which may involve harvesting data and applying formatting codes.
The mg2mgp directives are all of the same form: a word terminated by a %. Yes, that's exactly backwards from the %word format used by Magicpoint itself, so that if mg2mgp is unavailable, the presentation can still be prepared using Magicpoint. In contrast, if this program used additional directives of the %word form, each would trigger a fatal error if Magicpoint were run directly on the *.mg file.
hvgap% & qvgap%
Here's a line
halfgap%
I want this line pretty close to the previous one
quartergap%
# I want this image even closer to the line above
%newimage "pic.jgp"
Magicpoint doesn't provide any easy way to get a vertical gap that's smaller than usual, and then return to the previous setting. And this program can't really do that properly either, because only Magicpoint itself knows what the current vgap size is. Nonetheless, these directives have proven useful for producing vertical gaps of one-half and one-quarter the size of the $DEFAULT_VGAP setting in the configuration file.
Incidentally, the predefined vertical-gap styles, <V_30> through <V_95>, also return the vgap setting to $DEFAULT_GAP, but those styles are meant for controlling the vertical spacing within collections of text lines, whereas these directives merely insert a blank space.
include%
include% "filename"
File inclusion is provided by the include% directive. The contents
of the indicated file are read, and then recursively, its contents
are scanned for include% directives which are read, and so forth.
The resulting text is inserted into the *.mgp file in place of the
directive.
This is valuable for two reasons:
%filter "/bin/sort"
%include "input_lines.txt"
%endfilter
If the data don't reside in a file, but are available as command output,
then command% can provide a similar service,
%filter "/bin/sort"
command% "/bin/who"
%endfilter
which compensates for the fact that %filter doesn't allow conventional shell command sequences, such as:
%filter "/bin/who | /bin/sort"
and
%filter "/bin/sort < /etc/passwd"
skip% & unskip%
This line is in the presentation skip% This ones is NOT in today's presentation; maybe tomorrow! unskip% This line is in the presentation skip% The rest of the file is excluded, unless an C<unskip%> appears
``Line exclusion'' is provided by skip%/unskip%,
which allows a *.mg document to retain lines that do not become part
of the current presentation. This allows multiple versions of the presentation
to be retained in a single file,
by restricting the pages that will be shown in a particular talk.
code% [blank-gap:other-gap]
code% tail +1 perlgrep.plx 25:35
One problem with Magicpoint's %filter directive is that it doesn't support the concept of formatting variations within the command's output. Unless you edit the *.mgp file directly, there is no way to apply any markup variations to the obtained data.
The syntax requirement is simply that at least one non-whitespace character
appears after the code% directive.
If the vertical gap specifications are provided at the
end, they will be stripped off, and the
the rest will be submitted verbatim
to your OS's command interpreter, so you must also supply any quotes that might be needed.
(There are also security concerns, which are covered in the next subheading.
As a first step in providing something more useful for the display
of computer programs, code%
applies a fixed-width font and specified color to the acquired program text,
and
renders #-prefixed comments in a separately specified font and color
(according to the variable settings in
the configuration file).
The blank-gap dictates how much vertical space should be used to represent blank lines in the code, and the other-gap the amount of space to be used after non-blank lines. The units are percentages of the font height, so 100 means use a full-sized blank line, and 50 a half-size, etc.
Because this directive executes arbitrary commands submitted by the user, the usual precautions are applicable if the program is running with an ID other than that of the user executing it. (Later versions might use Perl's ``taint mode'', to do some sanity checking on the command. Until then, excercise caution with this directive!)
command%
command% nl -ba perlgrep.plx
The syntax requirement is simply that at least one non-whitespace character
appears after the command% directive. All the rest will be submitted verbatim
to your OS's command interpreter, so you must also supply any quotes that might be needed.
(There are also security concerns, which are covered in the next subheading.)
This directive is a variation on
code%, that simply imports the command output into the presentation (without applying any formatting).
Unlike Magicpoint's %filter directive,
pipelines and other complex commands can be used (as they can also with code%).
For example:
command% man mg2mgp | head -20 | col -bx
Because this directive executes arbitrary commands submitted by the user, the usual precautions are applicable if the program is running with an ID other than that of the user executing it. (Later versions might use Perl's ``taint mode'', to do some sanity checking on the command. Until then, excercise caution with this directive!)
tpage%
tpage%
The tpage% directive
provides support for sections started by ``title pages'',
whose headings have individually specified default text formats (TBD).
It can be used anywhere the standard %page directive would be allowed.
npage%
npage%
The npage% directive
makes pages that are
endowed with a header line containing the Author's name, the Copyright
year (defaulting to the current year), and a web-site URL, along with
page-numbering in the two-part section-page format.
The headings are governed by style specifications provided through variable settings in the .mg2mgprc file (still under development).
The npage% directive can be used anywhere the standard %page directive would be allowed.
Note that npage% is designed for use with tpage%. If you use it without
requesting a Title Page first, the section number will show as zero.
It's okay to intermix %page directives with these, but generally
undesirable. These directives do much more for you,
and you probably won't feel the need to use %page ever again.
table%
table%
(table specificatons)
endtable%
Under construction.
mg2mgp presentation.mg | mgp_nopause > presentation.mgp
OR
export MGP_NOPAUSE='on'; mg2mgp presentation.mg > presentation.mgp
To make it easier to proofread demonstrations, %pause directives can be filtered out of your *.mg file using the command mgp_nopause. This allows each page to be viewed in its entirety in one glance, which speeds up proofreading considerably.
As an alternative to using mgp_nopause (which is just another name for the mg2mgp program), you can set the environment variable MGP_NOPAUSE to ``enable'', and run mg2mgp instead.
Besides converting *.mg files to *.mgp files, this program can be used to convert *.po files (not quite in POD format) to *.pod files, if invoked under this alternate name.
The .mg2mgprc file can be used to define styles (STYLES) and variables (VARS) that make it vastly easier to prepare Magicpoint presentations. This program is distributed with a sample file, which you're free to edit to your own tastes.
For example, I use lots of colors, and would rather type C_OR to get orangered than its entire name. (HINT: use mgp_grep_colors 'red', for example, to see all available colors with red in their names).
The configuration file is looked for under the following directory/name combinations:
# mg2mgprc: sample configuration file for mg2mgprc, v 0.02 # Tim Maher, tim(AT)teachmeperl.com # Tue Aug 5 16:43:37 PDT 2003 # # Watch http://teachmeperl.com/mg2mgprc.html for further details on # usage, and for the latest version of the program # TODO: Allow include% directive to patch lines into this file->DONE! # TODO: Provide support for style "aliases" so RED means C_R, or # TODO: Prune out trailing spaces from style definitions # whatever # There are two sections to this file; VARS and STYLES. # The format for setting variables in the former is name=value No # quotes encasing the value are required or allowed, and no # terminating ";" is needed # fore_color and back_color are special variables that should be # set to the foreground/background color for the presentation. # code_color, and comment_color are respectively the colors you # want for code samples (imported via the code% directive) and # the comments within them; if these variables are unset, # reasonable default settings are used. # author, year, and url show up on non-title pages along with the # page number author should be set to the presentation's author, # and url to his/hers web site, and year to the copyright year; # it defaulst to the current year # You can set any other variables you want, and include them in # the style definitions that follow (although that feature is # not heavily tested yet) # If you want to disable sections of this file, you can put skip% # before the first line to be ignored, and unskip% after the last # to be ignored (or just omit that and ignore to the end of the # file). VARS # VARS names are case sensitive, so <z> and <Z> refer to # different variables. All special variables needed by the # program are ALL CAPS. Please use mixed-case or lower case for # your own variables # The characters permitted in variable names are letters, # digits, and _. # The following settings are used in the header-line of the npgage% directive AUTHOR=Tim Maher URL=www.TeachMePerl.com YEAR=2003 # The fore/back colors must match the ones used in the # MGP-included config file FORE_COLOR=white #FORE_COLOR=black # BACK_COLOR=black BACK_COLOR=white #BACK_COLOR=white # These are only used by code% directive, and have defaults if # not specified CODE_COLOR=white CODE_FONT=courierb CODE_SIZE=5 COMMENT_COLOR=yellow COMMENT_SIZE=5 # DEFAULT_VGAP is used to undo styles that change the vertical # gap, such as <V_35 This>, and as the numeric base for halving # and quartering for the halfgap% and quartergap% directives # 60 probably better choice/ 20 makes for very fine gradations DEFAULT_VGAP=20 # DEFAULT_VGAP=20 # DEFAULT_FONT is used to undo styles that change the font, such as # <F_B This>. DEFAULT_FONT="default" # DEFAULT_SIZE is used to undo styles that change the point size, such as # <S_3.5 This>. DEFAULT_SIZE=5 # By default, the styles you create will have case-insensitive # names, If you are willing to be more precise in your typing, # set the variable CASE_SENSITIVE_STYLES to yes in the line below. # CASE_SENSITIVE_STYLES=yes # # STYLES # This section defines the styles, such as Z, you're allowed to # use in the following two formats: <Z> and <Z more stuff> and # <Z more # stuff spanning lines> # The first line defines the style name; the second the "on" # value to turn it on, and the third, if present, the "off" value # to turn it off. There must be a blank line before each # style-definition line. The "off" value is only used with the # "more stuff" syntax shown above, so if you're going to use that # include an off-line, to avoid a fatal error. # There's no need to insert a blank line to occupy the off-line's # position if you don't want to make a setting, because the blank # line before the next style-name will serve to indicate its # absence. # # Style names are case sensitive, so <z> and <Z> refer # to different styles. Any visible character can be used in # a style name # To help me keep things straight, I like to have special name # formats for different classes of styles, as shown below. # # Sample Style Names # # Type Prefix Sample Definition Changes Effected # # Font F_ F_T %font "thick" font set to thick # Size S_ S_6.5 %size 6.5 text size to 6.5 points # Vgap V_ V_65 %vgap 65 vertical gap to 65 # Color C_ C_BL %fore "blue" foreground color to BLUE # Bullet B_ B_2 (from config) set to bullet-level 2 style # Headings H_ H_C (long) special heading inserted # Align A_ A_C %center centering enabled # Transform X_ X_L lowercase converts to lowercase # Miscellaneous Styles # Other (none) CHEAD (long) centered heading inserted # NOTE: You are also free to use the real name of any color, such as # "gold" and "goldenrod"; to get a list of choices, invoke # mg2mgp as mgp_grep_colors 'gold' (make the link, if necessary) # Note that styles can be aliased to multiple names, so the color # RED could be selected using <C_R>, <RED>, or by its numerical # RGB code. This will be implemented soon . . . # STYLES can be defined in terms of user-defined VARS, with a $ # preceding the variable name, as shown for the sample style "C_A" # below. This preliminary code release uses a very simple parser # to process these variable requests, so only simple variables # ($accent_color) are known to work so far; don't try other # Perlish things like $accent_colors[3,4], etc. # For example, the following definition is for changing the font to # the "accent color" (both variables must be set in the VARS # section of the mg2mgpr file): # C_A # %fore "$accent_color" # %fore "$FORE_COLOR" # To insert a blank line in the style definition, use \n. Because # blank lines that seem to be extraneous are removed by mg2mgp, # it's possible in some cases that the blank line signified by \n # won't actually show up in the presentation. In such cases, use # \nBR%\n instead, which will definitely work # The Importance of "Undo-ing" # # Note that some of the sample styles shown above exist # independently as MGP directives, and some of them aren't much # harder to type. For example, # # <C_BL>this # # is equivalent to # # %fore "blue" # this # # However, there's a distinct advantage to the style approach, # because # # <C_BL this> # # can render "this" as blue and then *reset the color* to a # reasonable default, which generates the following code, # # %fore "blue" # this # %fore "white" <- assuming FORE_COLOR set to "white" in .mg2mgprc # # -- assuming the following style definition : # # %fore "blue" # this # %fore "$FORE_COLOR" # # MGP could conceivably let the user request a reversion to the # previous color (a I<real> "undo", which would be ideal), but # that feature is not currently provided. # The following keyword introduces the style definitions STYLES # COMMENTS ARE ALLOWED HERE, but must have blank lines before and after # Alignment styles # D resets Font, Color, Size, and Vertical Gap to Defaults # NOTE: This style currently needs to introduce a SP, so # won't # end up as first char on line, and avoid printing the # comment! CONT %cont # Accent Code AC0 %fore "brown", size 5.75, font "cb" AC1 %fore "hotpink", size 5.5, font "cb" # AC1 # %fore "darkorchid", size 5.5, font "cb" # %fore "$FORE_COLOR", font "$FONT_DEF", size $SIZE_DEF AC2 %fore "lightsteelblue", size 5.5, font "cb" # %fore "steelblue", size 5.5, font "cb" AC3 %fore "darkgreen", size 5.5, font "cb" # %fore "$FORE_COLOR", font "$FONT_DEF", size $SIZE_DEF AW1 %fore "gold", size 5.5, font "bolditalic" #%fore "mediumblue", size 5.5, font "bolditalic" # %fore "$FORE_COLOR", font "$FONT_DEF", size $SIZE_DEF AW2 %fore "lightgreen", size 5.5, font "bolditalic" %fore "$FORE_COLOR", font "$FONT_DEF", size $SIZE_DEF # %fore "mediumseagreen", size 5.5, font "bolditalic" #%fore "darkgreen", size 5.5, font "bolditalic" AW3 %fore "red2", size 5.5, font "bolditalic" %fore "$FORE_COLOR", font "$FONT_DEF", size $SIZE_DEF # # Accent Word, #2 # AW2 # %fore "gold", size 5.5, font "cbi" # Following styles built-in now # COMMENT # %fore "$COMMENT_COLOR", font "ci", size $COMMENT_SIZE # %fore "$CODE_COLOR", size $CODE_SIZE CMT %fore "$COMMENT_COLOR", font "ci", size $COMMENT_SIZE, cont CMT2 %fore "$COMMENT_COLOR", font "ci", size $COMMENT_SIZE # %fore "$CODE_COLOR", size $CODE_SIZE #COMMENT_OFF #%fore "$CODE_COLOR", font "$CODE_FONT", size $CODE_SIZE #CMT_OFF #%fore "$CODE_COLOR", font "$CODE_FONT", size $CODE_SIZE # %fore "$CODE_COLOR", size $CODE_SIZE C_DEF %fore "$FORE_COLOR" A_DEFVGAP %vgap $DEFAULT_VGAP D %fore "$FORE_COLOR", font "$DEFAULT_FONT", size "$DEFAULT_SIZE, vgap "$DEFAULT_VGAP" C_FORE %fore "$FORE_COLOR" C_BACK %fore "$BACK_COLOR" A_L %leftfill A_C %center %leftfill A_R %right %leftfill # Miscellaneous styles # A shell-prompt style $ %leftfill, size 6, fore "lightsteelblue", font "tty"\n$\n%cont BAR \n%vgap 20, bar "gray" 10 15 70, cont\n FULLBAR \n%vgap 20, bar "gray" 10 15 100, cont\n # Font-changing styles # B_0 is a special "zero-level" (i.e., not indented) bullet # style, suitable for using above a B_1 stye B_0 %font "bull1", size 5.75, fore "powderblue", vgap 60 %font "default", fore "white" # B_2 # %font "bull1", size 5.75, fore "powderblue", vgap 60 # %font "default", fore "white" F_B %font "bold" %font "default", fore "$FORE_COLOR" F_T %font "thick" %font "default", fore "$FORE_COLOR" F_THICK %font "thick" %font "default", fore "$FORE_COLOR" F_THIN %font "thick" %font "default", fore "$FORE_COLOR" # Courier font F_C %font "c" F_BI %font "bolditalic" F_CB %font "cb" F_CBI %font "cbi" F_CI %font "ci" F_D %font "default" F_DEF %font "default" F_I %font "italic" F_IB %font "bolditalic" CHEAD %font "title", size 6, center, fore "sandybrown" %font "default", fore "$FORE_COLOR", leftfill CHEAD+ %font "bull1", size 6.5, center, fore "dodgerblue" %font "default", fore "$FORE_COLOR", leftfill CHEAD- %font "title", size 5.5, center, fore "sandybrown" %font "default", fore "$FORE_COLOR", leftfill CMD %leftfill, size 5.5, fore "$FORE_COLOR", font "courierb" CMD2 %leftfill, size 5.0, fore "$FORE_COLOR", font "courierb" CMD2.5 %leftfill, size 5.0, fore "$FORE_COLOR", font "courierb" CMD3 %leftfill, size 4.5, fore "$FORE_COLOR", font "courierb" CMD4 %leftfill, size 4.0, fore "$FORE_COLOR", font "courierb" CODE+ %leftfill, size 6.0, fore "$CODE_COLOR", font "courierb" CODE %leftfill, size 5.5, fore "$CODE_COLOR", font "courierb" CODE_SNIP %leftfill, size 5, fore "gold", font "courierb" SNIP_EXP %leftfill, size 4.5, fore "white", font "bull2" PARTS_TITLE %font "thick", fore "lightgray", size 6.6 PARTS_TEXT %font "thick", fore "gray", size 5.3 TITLE %font "expb", size 11.5 SUBTITLE %font "expb", size 7 CODE2 %leftfill, size 5.0, fore "$CODE_COLOR", font "courierb" CODE3 %leftfill, size 4.5, fore "$CODE_COLOR", font "courierb" C_B %fore "black" \n%fore "$FORE_COLOR", cont\n C_BL %fore "blue" \n%fore "$FORE_COLOR", cont\n C_CAB %fore "cadetblue" \n%fore "$FORE_COLOR", cont\n C_CH %fore "chocolate" %fore "$FORE_COLOR", cont\n C_CY %fore "cyan" \n%fore "$FORE_COLOR", cont\n C_DB %fore "dodgerblue" \n%fore "$FORE_COLOR", cont\n C_DGR %fore "darkgray" \n%fore "$FORE_COLOR", cont\n C_DR %fore "darkred" \n%fore "$FORE_COLOR", cont\n C_FU %fore "#FF00FF" \n%fore "$FORE_COLOR", cont\n C_G %fore "gold" \n%fore "$FORE_COLOR", cont\n C_GR %fore "gray" \n%fore "$FORE_COLOR", cont\n C_GR1 %fore "gray1" \n%fore "$FORE_COLOR", cont\n C_GR2 %fore "gray2" \n%fore "$FORE_COLOR", cont\n C_GR3 %fore "gray3" \n%fore "$FORE_COLOR", cont\n C_GR4 %fore "gray4" \n%fore "$FORE_COLOR", cont\n C_GRE %fore "green" \n%fore "$FORE_COLOR", cont\n C_DG %fore "darkgreen" \n%fore "$FORE_COLOR", cont\n C_HP %fore "hotpink" \n%fore "$FORE_COLOR", cont\n C_LB %fore "lightblue" \n%fore "$FORE_COLOR", cont\n C_LGN %fore "lightgreen" \n%fore "$FORE_COLOR", cont\n C_LGR %fore "lightgray" \n%fore "$FORE_COLOR", cont\n C_LI %fore "#00FF00" \n%fore "$FORE_COLOR", cont\n C_LIN %fore "linen" \n%fore "$FORE_COLOR", cont\n C_LSB %fore "lightskyblue" \n%fore "$FORE_COLOR", cont\n C_LSG %fore "lightslategray" \n%fore "$FORE_COLOR", cont\n C_LSTB %fore "lightsteelblue" \n%fore "$FORE_COLOR", cont\n C_M %fore "magenta" \n%fore "$FORE_COLOR", cont\n C_MA %fore "maroon" \n%fore "$FORE_COLOR", cont\n C_MBL %fore "mediumblue" \n%fore "$FORE_COLOR", cont\n C_MGR %fore "mediumgreen" \n%fore "$FORE_COLOR", cont\n C_MSG %fore "mediumseagreen" \n%fore "$FORE_COLOR", cont\n C_NA %fore "navy" \n%fore "$FORE_COLOR", cont\n C_OL %fore "#808000" \n%fore "$FORE_COLOR", cont\n C_OR %fore "orchid" \n%fore "$FORE_COLOR", cont\n C_T %fore "tan" \n%fore "$FORE_COLOR", cont\n C_O %fore "orange" \n%fore "$FORE_COLOR", cont\n C_ORD %fore "orangered" \n%fore "$FORE_COLOR", cont\n C_PA %fore "papayawhip" \n%fore "$FORE_COLOR", cont\n C_PB %fore "#B0E0E6" \n%fore "$FORE_COLOR", cont\n C_PG %fore "palegreen" \n%fore "$FORE_COLOR", cont\n C_PI %fore "pink" \n%fore "$FORE_COLOR", cont\n C_PU %fore "purple" \n%fore "$FORE_COLOR", cont\n C_R %fore "red" \n%fore "$FORE_COLOR", cont\n C_RB %fore "rosybrown" \n%fore "$FORE_COLOR", cont\n C_ROD %fore "goldenrod" \n%fore "$FORE_COLOR", cont\n C_SB %fore "sandybrown" \n%fore "$FORE_COLOR", cont\n C_SBL %fore "slateblue" \n%fore "$FORE_COLOR", cont\n C_SG %fore "slategray" \n%fore "$FORE_COLOR", cont\n C_SI %fore "#C0C0C0" \n%fore "$FORE_COLOR", cont\n C_SN %fore "snow" \n%fore "$FORE_COLOR", cont\n C_STB %fore "steelblue" \n%fore "$FORE_COLOR", cont\n C_TE %fore "#008080" \n%fore "$FORE_COLOR", cont\n C_TO %fore "tomato" \n%fore "$FORE_COLOR", cont\n C_W %fore "white" C_WS %fore "whitesmoke" \n%fore "$FORE_COLOR", cont\n C_GY %fore "greenyellow" \n%fore "$FORE_COLOR", cont\n C_YG %fore "yellowgreen" \n%fore "$FORE_COLOR", cont\n C_Y %fore "yellow" \n%fore "$FORE_COLOR", cont\n C_Y1 %fore "yellow1" \n%fore "$FORE_COLOR", cont\n C_Y2 %fore "yellow2" \n%fore "$FORE_COLOR", cont\n C_Y3 %fore "yellow3" \n%fore "$FORE_COLOR", cont\n C_Y4 %fore "yellow4" \n%fore "$FORE_COLOR", cont\n # Styles for specific headings # Input, Output headings HIN %font "title", size 6, leftfill, fore "sandybrown"\nInput\n%leftfill, font "default", fore "$FORE_COLOR" CHIN %font "title", size 6, leftfill, fore "sandybrown"\n%center\nInput\n%leftfill, font "default", fore "$FORE_COLOR" HOUT %font "title", size 6, leftfill, fore "sandybrown"\nOutput\n%leftfill, font "default", fore "$FORE_COLOR" CHOUT %font "title", size 6, leftfill, fore "sandybrown"\n%center\nOutput\n%leftfill, font "default", fore "$FORE_COLOR" # Following is experimental variation LHEAD %font "bull1", size 6.0, leftfill, fore "turquoise" %font "default", fore "$FORE_COLOR", leftfill LHEAD+ %font "bull1", size 6.5, leftfill, fore "turquoise" %font "default", fore "$FORE_COLOR", leftfill LHEAD- %font "bull1", size 5.5, leftfill, fore "turquoise" %font "default", fore "$FORE_COLOR", leftfill # Styles for rendering command output OUTPUT %leftfill, size 5.5, fore "lightgray", font "tty" OUTPUT2 %leftfill, size 5.0, fore "lightgray", font "tty" OUTPUT3 %leftfill, size 4.0, fore "lightgray", font "tty" # Style for heading of Problem PROB %font "title", size 6, center, fore "sandybrown"\nProblem\n%leftfill, font "default", fore "$FORE_COLOR" LPROB %font "title", size 6, leftfill, fore "sandybrown"\nProblem\n%leftfill, font "default", fore "$FORE_COLOR" SOL %font "title", size 6, center, fore "sandybrown"\nSolution\n%leftfill, font "default", fore "$FORE_COLOR" LSOL %font "title", size 6, leftfill, fore "sandybrown"\nSolution\n%leftfill, font "default", fore "$FORE_COLOR" # Title styles T1 %font "title", size 7\n T2 %font "title2", size 5\n TITLEB %font "bull1", size 6.0, fore "powderblue" # Font styles F_TTY %font "tty" F_WI %font "wide" F_WIB %font "wideb" F_X %font "exp" F_XB %font "expb" # Other experimental "Example" heading styles XC %center, fore "sandybrown" XL %center, fore "sandybrown" # Special heading for Examples XMP %font "title", size 6, center, fore "sandybrown"\nExamples\n%leftfill, font "default", fore "$FORE_COLOR" XMPL %font "title", size 6, leftfill, fore "sandybrown"\nExamples\n%leftfill, font "default", fore "$FORE_COLOR"
I am using this program heavily in my own work, so it is improving by leaps and bounds on a daily basis. Please let me know how you like it, and if you find any bugs.
Tim Maher, tim(AT)teachmeperl.com, yumpy(AT)cpan.org
Copyright (C) 2003, Timothy F. Maher. All rights reserved.
Consultix, a division of Pacific Software Gurus, Inc. www.teachmeperl.com
http://www.teachmeperl.com/mg2mgp.html