1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
<!doctype html public "-//W30//DTD W3 HTML 2.0//EN">
<HTML>
<!-- This file was generated using SDF 2.001 by
Ian Clatworthy (ianc@mincom.com). SDF is freely
available from http://www.mincom.com/mtr/sdf. -->
<HEAD>
<TITLE>SDF 2.001: SDF Reference: example Filter</TITLE>
</HEAD>
<BODY BGCOLOR="ffffff">
<DIV CLASS="header">
<P><IMG SRC="../sdflogo.gif" ALIGN="Right"></P>
<DIV CLASS="navigate">
<P ALIGN="Center"><A HREF="re_sdf.html">Contents</A> | <A HREF="in_filt.html">Parent Topic</A> | <A HREF="fend.html">Previous Topic</A> | <A HREF="ffront.html">Next Topic</A> <BR><A HREF="../index.html">Home</A> | <A HREF="../catalog.html">Catalog</A></P>
</DIV>
<BR CLEAR="Right">
</DIV>
<DIV CLASS="main">
<H1>5.14. example Filter</H1>
<HR>
<H2><A NAME="Interface">Interface</A></H2>
<P>The general syntax is:</P>
<PRE>
!block <STRONG>example</STRONG>[; parameters]
...
!endblock
</PRE>
<P>The parameters are:</P>
<TABLE CLASS="columns" BORDER>
<TR CLASS="heading">
<TD>
<STRONG>Name</STRONG>
</TD>
<TD>
<STRONG>Type</STRONG>
</TD>
<TD>
<STRONG>Rule</STRONG>
</TD>
</TR>
<TR>
<TD>
skipheader
</TD>
<TD>
boolean
</TD>
<TD>
</TD>
</TR>
<TR>
<TD>
lang
</TD>
<TD>
string
</TD>
<TD>
</TD>
</TR>
<TR>
<TD>
wide
</TD>
<TD>
boolean
</TD>
<TD>
</TD>
</TR>
<TR>
<TD>
listitem
</TD>
<TD>
integer
</TD>
<TD>
</TD>
</TR>
<TR>
<TD>
pure
</TD>
<TD>
boolean
</TD>
<TD>
</TD>
</TR>
</TABLE>
<P>See <A HREF="in_filif.html">Understanding Filter Interfaces</A>, if necessary.</P>
<HR>
<H2><A NAME="Description">Description</A></H2>
<P>The <EM>example</EM> filter is used to specify a section of fixed-width text. Unlike the <A HREF="../ref/fverbati.html">verbatim</A> filter, embedded SDF symbols (like {{) are relevant.</P>
<P>The <EM>skipheader</EM> parameter is useful when an external file is being included as an example, but you do not want the header comment in the example. The <EM>lang</EM> parameter, if any, is used to determine the commenting conventions. If no language is specified, comments are assumed to start with a # and be terminated by the end of line.</P>
<P>The <EM>lang</EM> parameter can be used to pretty-print programming languages. In practice, this means:</P>
<UL>
<LI>comments are output in italics
<LI>keywords are output in bold.</UL>
<P><HR WIDTH="80%" ALIGN="Left">
<STRONG>Note: </STRONG>The <A HREF="../ref/flangdef.html">langdefs</A> filter is used to configure the information the pretty-printing feature needs to know. A large number of languages are predefined in the <TT>stdlib/langdefs.sdm</TT> file.
<HR WIDTH="80%" ALIGN="Left"></P>
<P>The <EM>wide</EM> parameter can be used to ensure that at least 80 characters are output on a line before it is wrapped.</P>
<P>The <EM>listitem</EM> parameter can be used to specify that this block of text is part of a list. The value is the logical indent of the list (e.g. 1, 2, etc.).</P>
<P>The <EM>pure</EM> parameter can be used to escape special SDF symbols (like {{) embedded within the text.</P>
<HR>
<H2><A NAME="Examples">Examples</A></H2>
<PRE>
<I># Include myfile.c but exclude the copyright, revision history, etc.</I>
<B>!include</B> <TT>"myfile.c"</TT>; example; skipheader; lang=<TT>'c'</TT>
<I># Pretty-print the same file</I>
<B>!include</B> <TT>"myfile.c"</TT>; example; wide; lang=<TT>'c'</TT>
</PRE>
</DIV>
<DIV CLASS="footer">
<DIV CLASS="navigate">
<P ALIGN="Center"><A HREF="re_sdf.html">Contents</A> | <A HREF="in_filt.html">Parent Topic</A> | <A HREF="fend.html">Previous Topic</A> | <A HREF="ffront.html">Next Topic</A> <BR><A HREF="../index.html">Home</A> | <A HREF="../catalog.html">Catalog</A></P>
</DIV>
</DIV>
</BODY>
</HTML>
|