Contents Previous Next

Inserting Multiple Lines with %!postproc (such as CSS rules)

In filters, the replacement pattern can include multiple lines using the \n line break char.

This can be handy for including really short CSS rules on HTML target, with no need to create a separate file:

%!postproc: <HEAD>      '<HEAD>\n<STYLE TYPE="text/css">\n</STYLE>'
%!postproc: (</STYLE>)  'body     { margin:3em               ;} \n\1'
%!postproc: (</STYLE>)  'a        { text-decoration:none     ;} \n\1'
%!postproc: (</STYLE>)  'pre,code { background-color:#ffffcc ;} \n\1'
%!postproc: (</STYLE>)  'th       { background-color:yellow  ;} \n\1'

All the filters are tied to the first one, by replacing a string that it has inserted. So a single "<HEAD>" turns to:

<STYLE TYPE="text/css">
body     { margin:3em               ;}
a        { text-decoration:none     ;}
pre,code { background-color:#ffffcc ;}
th       { background-color:yellow  ;}

Contents Previous Next