comparison en/ch11-template.xml @ 724:cfdb601a3c8b

Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
author Dongsheng Song <dongsheng.song@gmail.com>
date Thu, 12 Mar 2009 15:51:39 +0800
parents 13513d2a128d
children d0160b0b1a9e
comparison
equal deleted inserted replaced
723:3c5e1c03cc3e 724:cfdb601a3c8b
1 <!-- vim: set filetype=docbkxml shiftwidth=2 autoindent expandtab tw=77 : --> 1 <!-- vim: set filetype=docbkxml shiftwidth=2 autoindent expandtab tw=77 : -->
2 2
3 <chapter id="chap:template"> 3 <chapter id="chap.template">
4 <?dbhtml filename="customizing-the-output-of-mercurial.html"?> 4 <?dbhtml filename="customizing-the-output-of-mercurial.html"?>
5 <title>Customising the output of Mercurial</title> 5 <title>Customising the output of Mercurial</title>
6 6
7 <para>Mercurial provides a powerful mechanism to let you control how 7 <para>Mercurial provides a powerful mechanism to let you control how
8 it displays information. The mechanism is based on templates. 8 it displays information. The mechanism is based on templates.
9 You can use templates to generate specific output for a single 9 You can use templates to generate specific output for a single
10 command, or to customise the entire appearance of the built-in web 10 command, or to customise the entire appearance of the built-in web
11 interface.</para> 11 interface.</para>
12 12
13 <sect1 id="sec:style"> 13 <sect1 id="sec.style">
14 <title>Using precanned output styles</title> 14 <title>Using precanned output styles</title>
15 15
16 <para>Packaged with Mercurial are some output styles that you can 16 <para>Packaged with Mercurial are some output styles that you can
17 use immediately. A style is simply a precanned template that 17 use immediately. A style is simply a precanned template that
18 someone wrote and installed somewhere that Mercurial can 18 someone wrote and installed somewhere that Mercurial can
104 <para>Notice that the template string above ends with the text 104 <para>Notice that the template string above ends with the text
105 <quote><literal>\n</literal></quote>. This is an 105 <quote><literal>\n</literal></quote>. This is an
106 <emphasis>escape sequence</emphasis>, telling Mercurial to print 106 <emphasis>escape sequence</emphasis>, telling Mercurial to print
107 a newline at the end of each template item. If you omit this 107 a newline at the end of each template item. If you omit this
108 newline, Mercurial will run each piece of output together. See 108 newline, Mercurial will run each piece of output together. See
109 section <xref linkend="sec:template:escape"/> for more details 109 section <xref linkend="sec.template.escape"/> for more details
110 of escape sequences.</para> 110 of escape sequences.</para>
111 111
112 <para>A template that prints a fixed string of text all the time 112 <para>A template that prints a fixed string of text all the time
113 isn't very useful; let's try something a bit more 113 isn't very useful; let's try something a bit more
114 complex.</para> 114 complex.</para>
122 braces (<quote><literal>{</literal></quote> and 122 braces (<quote><literal>{</literal></quote> and
123 <quote><literal>}</literal></quote>), it will try to replace the braces 123 <quote><literal>}</literal></quote>), it will try to replace the braces
124 and text with the expansion of whatever is inside. To print a 124 and text with the expansion of whatever is inside. To print a
125 literal curly brace, you must escape it, as described in section 125 literal curly brace, you must escape it, as described in section
126 <xref 126 <xref
127 linkend="sec:template:escape"/>.</para> 127 linkend="sec.template.escape"/>.</para>
128 128
129 </sect1> 129 </sect1>
130 <sect1 id="sec:template:keyword"> 130 <sect1 id="sec.template.keyword">
131 <title>Common template keywords</title> 131 <title>Common template keywords</title>
132 132
133 <para>You can start writing simple templates immediately using the 133 <para>You can start writing simple templates immediately using the
134 keywords below.</para> 134 keywords below.</para>
135 135
147 <listitem><para><literal role="template-keyword">date</literal>: 147 <listitem><para><literal role="template-keyword">date</literal>:
148 Date information. The date when the changeset was 148 Date information. The date when the changeset was
149 committed. This is <emphasis>not</emphasis> human-readable; 149 committed. This is <emphasis>not</emphasis> human-readable;
150 you must pass it through a filter that will render it 150 you must pass it through a filter that will render it
151 appropriately. See section <xref 151 appropriately. See section <xref
152 linkend="sec:template:filter"/> for more information 152 linkend="sec.template.filter"/> for more information
153 on filters. The date is expressed as a pair of numbers. The 153 on filters. The date is expressed as a pair of numbers. The
154 first number is a Unix UTC timestamp (seconds since January 154 first number is a Unix UTC timestamp (seconds since January
155 1, 1970); the second is the offset of the committer's 155 1, 1970); the second is the offset of the committer's
156 timezone from UTC, in seconds.</para> 156 timezone from UTC, in seconds.</para>
157 </listitem> 157 </listitem>
195 195
196 <para>As we noted above, the date keyword does not produce 196 <para>As we noted above, the date keyword does not produce
197 human-readable output, so we must treat it specially. This 197 human-readable output, so we must treat it specially. This
198 involves using a <emphasis>filter</emphasis>, about which more 198 involves using a <emphasis>filter</emphasis>, about which more
199 in section <xref 199 in section <xref
200 linkend="sec:template:filter"/>.</para> 200 linkend="sec.template.filter"/>.</para>
201 201
202 &interaction.template.simple.datekeyword; 202 &interaction.template.simple.datekeyword;
203 203
204 </sect1> 204 </sect1>
205 <sect1 id="sec:template:escape"> 205 <sect1 id="sec.template.escape">
206 <title>Escape sequences</title> 206 <title>Escape sequences</title>
207 207
208 <para>Mercurial's templating engine recognises the most commonly 208 <para>Mercurial's templating engine recognises the most commonly
209 used escape sequences in strings. When it sees a backslash 209 used escape sequences in strings. When it sees a backslash
210 (<quote><literal>\</literal></quote>) character, it looks at the 210 (<quote><literal>\</literal></quote>) character, it looks at the
242 <quote><literal>{</literal></quote>, or 242 <quote><literal>{</literal></quote>, or
243 <quote><literal>{</literal></quote> character, you must escape 243 <quote><literal>{</literal></quote> character, you must escape
244 it.</para> 244 it.</para>
245 245
246 </sect1> 246 </sect1>
247 <sect1 id="sec:template:filter"> 247 <sect1 id="sec.template.filter">
248 <title>Filtering keywords to change their results</title> 248 <title>Filtering keywords to change their results</title>
249 249
250 <para>Some of the results of template expansion are not 250 <para>Some of the results of template expansion are not
251 immediately easy to use. Mercurial lets you specify an optional 251 immediately easy to use. Mercurial lets you specify an optional
252 chain of <emphasis>filters</emphasis> to modify the result of 252 chain of <emphasis>filters</emphasis> to modify the result of