source: trunk/Distribution/XSL/params/man.string.subst.map.xml@ 3

Last change on this file since 3 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 7.8 KB
Line 
1<refentry id="man.string.subst.map">
2<refmeta>
3<refentrytitle>man.string.subst.map</refentrytitle>
4<refmiscinfo role="type">string</refmiscinfo>
5</refmeta>
6<refnamediv>
7<refname>man.string.subst.map</refname>
8<refpurpose>Specifies a set of string substitutions</refpurpose>
9</refnamediv>
10
11<refsynopsisdiv>
12<src:fragment id='man.string.subst.map.frag'>
13<xsl:param name="man.string.subst.map">
14 <substitution oldstring="\" newstring="\\"/>
15 <!-- * now, we need to restore single-backslashes in all roff -->
16 <!-- * requests (because the substitution above doubled them) -->
17 <substitution oldstring="\\fB" newstring="\fB"/>
18 <substitution oldstring="\\fI" newstring="\fI"/>
19 <substitution oldstring="\\fR" newstring="\fR"/>
20 <substitution oldstring='\\%' newstring='\%'/>
21 <substitution oldstring='\\&amp;' newstring='\&amp;'/>
22 <substitution oldstring='.\\"' newstring='.\"'/>
23 <!-- * although the groff docs do not make it clear, it appears that -->
24 <!-- * the only way to get a non-breaking hyphen in roff is to put a -->
25 <!-- * backslash in front of it; and, unfortunately, groff is not smart -->
26 <!-- * about where it breaks things (for example, it'll break an -->
27 <!-- * argument for a command across a line, if that argument contains -->
28 <!-- * a dash/hyphen); so, we must globally change all hyphens to "\-" -->
29 <substitution oldstring="-" newstring="\-"/>
30 <!-- * now, we need to restore single-hypens in all roff requests -->
31 <!-- * (because the substitution above added backslashes before them) -->
32 <substitution oldstring=".sp \-" newstring=".sp -"/>
33 <substitution oldstring=".it 1 an\-trap" newstring=".it 1 an-trap"/>
34 <substitution oldstring=".nr an\-no\-space\-flag 1" newstring=".nr an-no-space-flag 1"/>
35 <substitution oldstring=".nr an\-break\-flag 1" newstring=".nr an-break-flag 1"/>
36 <!-- * squeeze multiple newlines before a roff request -->
37 <substitution oldstring="&#10;&#10;." newstring="&#10;."/>
38 <!-- * remove any .sp occurences that directly follow a .PP -->
39 <substitution oldstring=".PP&#10;.sp" newstring=".PP"/>
40 <!-- * squeeze multiple newlines after start of no-fill (verbatim) env. -->
41 <substitution oldstring=".nf&#10;&#10;" newstring=".nf&#10;"/>
42 <!-- * an apostrophe at the beginning of a line gets interpreted as a -->
43 <!-- * roff request (groff(7) says it is "the non-breaking control -->
44 <!-- * character"); so we must add backslash before any apostrophe -->
45 <!-- * found at the start of a line -->
46 <substitution oldstring="&#10;'" newstring="&#10;\'"/>
47 <!-- * -->
48 <!-- * non-breaking space -->
49 <!-- * -->
50 <!-- * A no-break space can be written two ways in roff; the difference, -->
51 <!-- * according to the "Page Motions" node in the groff info page, ixsl: -->
52 <!-- * -->
53 <!-- * "\ " = -->
54 <!-- * An unbreakable and unpaddable (i.e. not expanded during filling) -->
55 <!-- * space. -->
56 <!-- * -->
57 <!-- * "\~" = -->
58 <!-- * An unbreakable space that stretches like a normal -->
59 <!-- * inter-word space when a line is adjusted." -->
60 <!-- * -->
61 <!-- * Unfortunately, roff seems to do some weird things with long -->
62 <!-- * lines that only have words separated by "\~" spaces, so it's -->
63 <!-- * safer just to stick with the "\ " space -->
64 <substitution oldstring="&#x00a0;" newstring="\ "/>
65 <!-- * bullet -->
66 <substitution oldstring="&#x2022;" newstring="\(bu"/>
67 <!-- * left double quote -->
68 <substitution oldstring="&#x201c;" newstring="\(lq"/>
69 <!-- * right double quote -->
70 <substitution oldstring="&#x201d;" newstring="\(rq"/>
71 <!-- * left single quote -->
72 <substitution oldstring="&#x2018;" newstring="\(oq"/>
73 <!-- * right single quote -->
74 <substitution oldstring="&#x2019;" newstring="\(cq"/>
75 <!-- * copyright sign -->
76 <substitution oldstring="&#x00a9;" newstring="\(co"/>
77 <!-- * registered sign -->
78 <substitution oldstring="&#x00ae;" newstring="\(rg"/>
79 <!-- * servicemark -->
80 <!-- * there is no groff equivalent for it -->
81 <substitution oldstring="&#x2120;" newstring="(SM)"/>
82 <!-- * trademark -->
83 <!-- * we don't do "\(tm" because for console output -->
84 <!-- * because groff just renders that as "tm"; that is: -->
85 <!-- * -->
86 <!-- * Product&#x2122; -> Producttm -->
87 <!-- * -->
88 <!-- * So we just make it to "(TM)" instead; thus: -->
89 <!-- * -->
90 <!-- * Product&#x2122; -> Product(TM) -->
91 <substitution oldstring="&#x2122;" newstring="(TM)"/>
92</xsl:param>
93</src:fragment>
94</refsynopsisdiv>
95
96<refsect1><title>Description</title>
97
98<para>The <parameter>man.string.subst.map</parameter> parameter
99contains <link linkend="map">a map</link> that specifies a set of
100string substitutions to perform over the entire roff source for each
101man page, either just before generating final man-page output (that
102is, before writing man-page files to disk) or, if the value of the
103<parameter>man.charmap.enabled</parameter> parameter is non-zero,
104before applying the roff character map.</para>
105
106<para>You can use <parameter>man.string.subst.map</parameter> as a
107"lightweight" character map to perform "essential" substitutions --
108that is, substitutions that are <emphasis>always</emphasis> performed,
109even if the value of the <parameter>man.charmap.enabled</parameter>
110parameter is zero. For example, you can use it to replace quotation
111marks or other special characters that are generated by the DocBook
112XSL stylesheets for a particular locale setting (as opposed to those
113characters that are actually in source XML documents), or to replace
114any special characters that may be automatically generated by a
115particular customization of the DocBook XSL stylesheets.</para>
116
117<warning>
118 <para>Do you not change value of the
119 <parameter>man.string.subst.map</parameter> parameter unless
120 you are sure what you are doing. If you remove any of the default
121 mappings, you are likely to end up with broken output. And be very
122 careful about adding anything to it. Because it is used for doing
123 string substitution over the entire roff source of each man page, it
124 causes target strings to be replaced in roff requests and escapes,
125 not just in the visible contents.</para>
126
127 <para>In particular, do not attempt to add a mapping for the
128 dot/period character. Doing so will break your output. For an
129 explanation, see <xref linkend="Dots"/>.</para>
130
131</warning>
132
133<refsect2 id="map">
134 <title>Contents of the substitution map</title>
135 <para>The string-substitution map contains one or more <tag
136 namespace="http://docbook.sf.net/xmlns/string.subst/1.0"
137 >substitution</tag> elements, each of which has two attributes:
138 <variablelist>
139 <varlistentry>
140 <term>oldstring</term>
141 <listitem>
142 <simpara>string to replace</simpara>
143 </listitem>
144 </varlistentry>
145 <varlistentry>
146 <term>newstring</term>
147 <listitem>
148 <simpara>string with which to replace <tag class="attribute"
149 >oldstring</tag></simpara>
150 </listitem>
151 </varlistentry>
152 </variablelist>
153 It may also include XML comments (that is, delimited with
154 "<literal>&lt;!--</literal>" and "<literal>--></literal>").
155 </para>
156</refsect2>
157
158<refsect2 id="Dots">
159 <title>About adding backslashes before dots</title>
160 <para>The stylesheets do not add backslashes before
161 periods/dots. One reason is that, because string substitution is
162 performed over the entire roff source of each man page, it would be
163 complicated to replace dots in visible contents without also causing
164 them to be replaced in roff requests and escapes; for example,
165 without causing, say, the <literal>.TH</literal> roff macro to be
166 replaced with <literal>\.TH</literal>. Additionally, backslashes in
167 front of periods/dots are needed only in the very rare case where a
168 period is the very first character in a line, without any space in
169 front of it. A better way to deal with that rare case is to add a
170 zero-width space in front of the offending dot(s) in your
171 source.</para>
172</refsect2>
173
174</refsect1>
175</refentry>
Note: See TracBrowser for help on using the repository browser.