# HG changeset patch # User Yoshiki Yazawa # Date 1222091337 -32400 # Node ID 96437101a088b6a4f4af8d24094ff1af0175b640 # Parent 45ad9986748a2cf67030dc83c22e544ba441c1c6 more template.tex diff -r 45ad9986748a -r 96437101a088 ja/Makefile --- a/ja/Makefile Mon Sep 22 01:42:57 2008 +0900 +++ b/ja/Makefile Mon Sep 22 22:48:57 2008 +0900 @@ -116,6 +116,7 @@ dvi: $(sources) $(image-eps) platex 00book.tex + cp 00book.aux hgbook.aux bibtex hgbook platex 00book.tex diff -r 45ad9986748a -r 96437101a088 ja/template.tex --- a/ja/template.tex Mon Sep 22 01:42:57 2008 +0900 +++ b/ja/template.tex Mon Sep 22 22:48:57 2008 +0900 @@ -64,8 +64,8 @@ %command by editing your \hgrc file, naming the style you would %prefer to use. -Mercurialの全てのコマンドで用いられる出力スタイルは\hgrcファイルを編集す -ることで設定でき,好きな名前を付けることができる. +Mercurialの全てのコマンドで用いられる出力スタイルは \hgrc ファイルを編集 +することで設定でき,好きな名前を付けることができる. \begin{codesample2} [ui] @@ -274,125 +274,239 @@ \section{エスケープシーケンス} \label{sec:template:escape} -Mercurial's templating engine recognises the most commonly used escape -sequences in strings. When it sees a backslash (``\Verb+\+'') -character, it looks at the following character and substitutes the two -characters with a single replacement, as described below. +%Mercurial's templating engine recognises the most commonly used escape +%sequences in strings. When it sees a backslash (``\Verb+\+'') +%character, it looks at the following character and substitutes the two +%characters with a single replacement, as described below. + +Mercurialのテンプレートエンジンは文字列で最もよく使用されるエスケープシー +ケンスを認識する.エンジンはバックスラッシュ(``\Verb+\+'')を見つけると後 +続の文字を含む2文字を以下のような1文字で置換する. \begin{itemize} -\item[\Verb+\textbackslash\textbackslash+] Backslash, ``\Verb+\+'', +%\item[\Verb+\textbackslash\textbackslash+] Backslash, ``\Verb+\+'', +% ASCII~134. +%\item[\Verb+\textbackslash n+] Newline, ASCII~12. +%\item[\Verb+\textbackslash r+] Carriage return, ASCII~15. +%\item[\Verb+\textbackslash t+] Tab, ASCII~11. +%\item[\Verb+\textbackslash v+] Vertical tab, ASCII~13. +%\item[\Verb+\textbackslash \{+] Open curly brace, ``\Verb+{+'', ASCII~173. +%\item[\Verb+\textbackslash \}+] Close curly brace, ``\Verb+}+'', ASCII~175. +\item[\Verb+\textbackslash\textbackslash+] バックスラッシュ, ``\Verb+\+'', ASCII~134. -\item[\Verb+\textbackslash n+] Newline, ASCII~12. -\item[\Verb+\textbackslash r+] Carriage return, ASCII~15. -\item[\Verb+\textbackslash t+] Tab, ASCII~11. -\item[\Verb+\textbackslash v+] Vertical tab, ASCII~13. -\item[\Verb+\textbackslash \{+] Open curly brace, ``\Verb+{+'', ASCII~173. -\item[\Verb+\textbackslash \}+] Close curly brace, ``\Verb+}+'', ASCII~175. +\item[\Verb+\textbackslash n+] 改行, ASCII~12. +\item[\Verb+\textbackslash r+] 復帰, ASCII~15. +\item[\Verb+\textbackslash t+] タブ, ASCII~11. +\item[\Verb+\textbackslash v+] 垂直タブ, ASCII~13. +\item[\Verb+\textbackslash \{+] 開き中括弧, ``\Verb+{+'', ASCII~173. +\item[\Verb+\textbackslash \}+] 閉じ中括弧, ``\Verb+}+'', ASCII~175. \end{itemize} -As indicated above, if you want the expansion of a template to contain -a literal ``\Verb+\+'', ``\Verb+{+'', or ``\Verb+{+'' character, you -must escape it. +%As indicated above, if you want the expansion of a template to contain +%a literal ``\Verb+\+'', ``\Verb+{+'', or ``\Verb+{+'' character, you +%must escape it. + +上に示したように,テンプレートの展開の際に文字 +``\Verb+\+'', ``\Verb+{+'', または``\Verb+{+''を入れたい場合はエスケープ +することが必要である. %\section{Filtering keywords to change their results} \section{結果を改変するフィルタキーワード} \label{sec:template:filter} -Some of the results of template expansion are not immediately easy to -use. Mercurial lets you specify an optional chain of \emph{filters} -to modify the result of expanding a keyword. You have already seen a -common filter, \tplkwfilt{date}{isodate}, in action above, to make a -date readable. +%Some of the results of template expansion are not immediately easy to +%use. Mercurial lets you specify an optional chain of \emph{filters} +%to modify the result of expanding a keyword. You have already seen a +%common filter, \tplkwfilt{date}{isodate}, in action above, to make a +%date readable. + +テンプレート展開の結果のうち,いくつかはたやすく利用できるものではない. +Mercurialは展開されるキーワードを変更するための一連の\emph{filters}オプショ +ンを提供している.日時を可読にするためによく用いられる +\tplkwfilt{date}{isodate}フィルタの動作例については既に見てきた. -Below is a list of the most commonly used filters that Mercurial -supports. While some filters can be applied to any text, others can -only be used in specific circumstances. The name of each filter is -followed first by an indication of where it can be used, then a -description of its effect. +%Below is a list of the most commonly used filters that Mercurial +%supports. While some filters can be applied to any text, others can +%only be used in specific circumstances. The name of each filter is +%followed first by an indication of where it can be used, then a +%description of its effect. + +以下に示すのはMercurialがサポートするフィルタの中で最もよく使われるもので +ある.いくつかのフィルタは任意の文字列に対して適用可能な一方,他のものは +特定の状況においてのみ利用可能である.各々のフィルタの名前は,利用可能な +状況を示す表示で始まり,得られる効果の説明が続く. \begin{itemize} -\item[\tplfilter{addbreaks}] Any text. Add an XHTML ``\Verb+
+'' - tag before the end of every line except the last. For example, - ``\Verb+foo\nbar+'' becomes ``\Verb+foo
\nbar+''. -\item[\tplkwfilt{date}{age}] \tplkword{date} keyword. Render the - age of the date, relative to the current time. Yields a string like - ``\Verb+10 minutes+''. -\item[\tplfilter{basename}] Any text, but most useful for the - \tplkword{files} keyword and its relatives. Treat the text as a - path, and return the basename. For example, ``\Verb+foo/bar/baz+'' - becomes ``\Verb+baz+''. -\item[\tplkwfilt{date}{date}] \tplkword{date} keyword. Render a date - in a similar format to the Unix \tplkword{date} command, but with - timezone included. Yields a string like - ``\Verb+Mon Sep 04 15:13:13 2006 -0700+''. -\item[\tplkwfilt{author}{domain}] Any text, but most useful for the - \tplkword{author} keyword. Finds the first string that looks like - an email address, and extract just the domain component. For - example, ``\Verb+Bryan O'Sullivan +'' becomes - ``\Verb+serpentine.com+''. -\item[\tplkwfilt{author}{email}] Any text, but most useful for the - \tplkword{author} keyword. Extract the first string that looks like - an email address. For example, - ``\Verb+Bryan O'Sullivan +'' becomes - ``\Verb+bos@serpentine.com+''. -\item[\tplfilter{escape}] Any text. Replace the special XML/XHTML - characters ``\Verb+&+'', ``\Verb+<+'' and ``\Verb+>+'' with - XML entities. -\item[\tplfilter{fill68}] Any text. Wrap the text to fit in 68 - columns. This is useful before you pass text through the - \tplfilter{tabindent} filter, and still want it to fit in an - 80-column fixed-font window. -\item[\tplfilter{fill76}] Any text. Wrap the text to fit in 76 - columns. -\item[\tplfilter{firstline}] Any text. Yield the first line of text, - without any trailing newlines. -\item[\tplkwfilt{date}{hgdate}] \tplkword{date} keyword. Render the - date as a pair of readable numbers. Yields a string like - ``\Verb+1157407993 25200+''. -\item[\tplkwfilt{date}{isodate}] \tplkword{date} keyword. Render the - date as a text string in ISO~8601 format. Yields a string like - ``\Verb+2006-09-04 15:13:13 -0700+''. -\item[\tplfilter{obfuscate}] Any text, but most useful for the - \tplkword{author} keyword. Yield the input text rendered as a - sequence of XML entities. This helps to defeat some particularly - stupid screen-scraping email harvesting spambots. +%\item[\tplfilter{addbreaks}] Any text. Add an XHTML ``\Verb+
+'' +% tag before the end of every line except the last. For example, +% ``\Verb+foo\nbar+'' becomes ``\Verb+foo
\nbar+''. + +\item[\tplfilter{addbreaks}] 任意のテキスト.XHTMLタグ``\Verb+
+'' +を最終行以外の各行の末尾に追加する.例えば``\Verb+foo\nbar+''は + ``\Verb+foo
\nbar+''となる. + +%\item[\tplkwfilt{date}{age}] \tplkword{date} keyword. Render the +% age of the date, relative to the current time. Yields a string like +% ``\Verb+10 minutes+''. + +\item[\tplkwfilt{date}{age}] \tplkword{date}キーワード.日時の経過時間を + 現在を起点に整形する.結果は + ``\Verb+10 minutes+''のようになる + +%\item[\tplfilter{basename}] Any text, but most useful for the +% \tplkword{files} keyword and its relatives. Treat the text as a +% path, and return the basename. For example, ``\Verb+foo/bar/baz+'' +% becomes ``\Verb+baz+''. + +\item[\tplfilter{basename}] 任意のテキストだが,\tplkword{files}キーワー + ドやその関連キーワードに対して最も有用であ + る.テキストをパスとして扱い,ベースネームを + 返す.例えば``\Verb+foo/bar/baz+''は + ``\Verb+baz+''となる. + +%\item[\tplkwfilt{date}{date}] \tplkword{date} keyword. Render a date +% in a similar format to the Unix \tplkword{date} command, but with +% timezone included. Yields a string like +% ``\Verb+Mon Sep 04 15:13:13 2006 -0700+''. + +\item[\tplkwfilt{date}{date}] \tplkword{date}キーワード.日時をUnixの + \tplkword{date}コマンドの出力にタイムゾーン + 情報を追加した形式に整形する.結果は + ``\Verb+Mon Sep 04 15:13:13 2006 -0700+''の + ようになる. + +%\item[\tplkwfilt{author}{domain}] Any text, but most useful for the +% \tplkword{author} keyword. Finds the first string that looks like +% an email address, and extract just the domain component. For +% example, ``\Verb+Bryan O'Sullivan +'' becomes +% ``\Verb+serpentine.com+''. + +\item[\tplkwfilt{author}{domain}] 任意のテキスト.\tplkword{author}キーワー + ドでの使用に最も有用.最初に現れるemailアド + レス形式の文字列を見つけ,ドメイン部分だけを + 抜き出す.例えば + ``\Verb+Bryan O'Sullivan +'' + は``\Verb+serpentine.com+''となる. + +%\item[\tplkwfilt{author}{email}] Any text, but most useful for the +% \tplkword{author} keyword. Extract the first string that looks like +% an email address. For example, +% ``\Verb+Bryan O'Sullivan +'' becomes +% ``\Verb+bos@serpentine.com+''. + +\item[\tplkwfilt{author}{email}] 任意のテキスト.\tplkword{author}キーワー + ドで最も有用.最初に現れるemailアドレス形式 + の文字列を抜き出す.例えば + ``\Verb+Bryan O'Sullivan +'' + は``\Verb+bos@serpentine.com+''となる. + +%\item[\tplfilter{escape}] Any text. Replace the special XML/XHTML +% characters ``\Verb+&+'', ``\Verb+<+'' and ``\Verb+>+'' with +% XML entities. + +\item[\tplfilter{escape}] 任意のテキスト.XML/XHTML文字 + ``\Verb+&+'', ``\Verb+<+''および + ``\Verb+>+''をXMLエンティティで置換する. + +%\item[\tplfilter{fill68}] Any text. Wrap the text to fit in 68 +% columns. This is useful before you pass text through the +% \tplfilter{tabindent} filter, and still want it to fit in an +% 80-column fixed-font window. + +\item[\tplfilter{fill68}] 任意のテキスト.テキストを68桁に収まるように整 + 形する.これは80桁に固定された端末での表示用 + に\tplfilter{tabindent}フィルタを使う際に便 + 利である. + +%\item[\tplfilter{fill76}] Any text. Wrap the text to fit in 76 +% columns. + +\item[\tplfilter{fill76}] 任意のテキスト.76桁に収まるように整形する. + +%\item[\tplfilter{firstline}] Any text. Yield the first line of text, +% without any trailing newlines. + +\item[\tplfilter{firstline}] 任意のテキスト最初の行だけを出力し,後続の + 行は一切出力しない. + +%\item[\tplkwfilt{date}{hgdate}] \tplkword{date} keyword. Render the +% date as a pair of readable numbers. Yields a string like +% ``\Verb+1157407993 25200+''. + +\item[\tplkwfilt{date}{hgdate}] \tplkword{date}キーワード.日時を可読な + 数字のペアに整形する.``\Verb+115740799325200+''のような文字列を出力する. + +%\item[\tplkwfilt{date}{isodate}] \tplkword{date} keyword. Render the +% date as a text string in ISO~8601 format. Yields a string like +% ``\Verb+2006-09-04 15:13:13 -0700+''. + +\item[\tplkwfilt{date}{isodate}] \tplkword{date}キーワード.日時を + ISO~8601フォーマットに整形する.出力は + ``\Verb+2006-09-04 15:13:13 -0700+''のように + なる. + +%\item[\tplfilter{obfuscate}] Any text, but most useful for the +% \tplkword{author} keyword. Yield the input text rendered as a +% sequence of XML entities. This helps to defeat some particularly +% stupid screen-scraping email harvesting spambots. + +\item[\tplfilter{obfuscate}]任意のテキスト.\tplkword{author}キーワードと + 併せて利用する場合最も有用.入力されたテキス + トをXMLエンティティのシーケンスとして出力す + る.これは画面をスクレイピングする間抜けなス + パムボットを避ける働きがある. + \item[\tplkwfilt{author}{person}] Any text, but most useful for the \tplkword{author} keyword. Yield the text before an email address. For example, ``\Verb+Bryan O'Sullivan +'' becomes ``\Verb+Bryan O'Sullivan+''. + \item[\tplkwfilt{date}{rfc822date}] \tplkword{date} keyword. Render a date using the same format used in email headers. Yields a string like ``\Verb+Mon, 04 Sep 2006 15:13:13 -0700+''. + \item[\tplkwfilt{node}{short}] Changeset hash. Yield the short form of a changeset hash, i.e.~a 12-byte hexadecimal string. + \item[\tplkwfilt{date}{shortdate}] \tplkword{date} keyword. Render the year, month, and day of the date. Yields a string like ``\Verb+2006-09-04+''. + \item[\tplfilter{strip}] Any text. Strip all leading and trailing whitespace from the string. + \item[\tplfilter{tabindent}] Any text. Yield the text, with every line except the first starting with a tab character. + \item[\tplfilter{urlescape}] Any text. Escape all characters that are considered ``special'' by URL parsers. For example, \Verb+foo bar+ becomes \Verb+foo%20bar+. + \item[\tplkwfilt{author}{user}] Any text, but most useful for the \tplkword{author} keyword. Return the ``user'' portion of an email address. For example, ``\Verb+Bryan O'Sullivan +'' becomes ``\Verb+bos+''. + + \end{itemize} \begin{figure} \interaction{template.simple.manyfilters} - \caption{Template filters in action} +% \caption{Template filters in action} + \caption{テンプレートフィルタの動作} \label{fig:template:filters} \end{figure} \begin{note} - If you try to apply a filter to a piece of data that it cannot - process, Mercurial will fail and print a Python exception. For - example, trying to run the output of the \tplkword{desc} keyword - into the \tplkwfilt{date}{isodate} filter is not a good idea. +% If you try to apply a filter to a piece of data that it cannot +% process, Mercurial will fail and print a Python exception. For +% example, trying to run the output of the \tplkword{desc} keyword +% into the \tplkwfilt{date}{isodate} filter is not a good idea. +フィルタを適用不能なデータに対して使おうとするとMercurialはエラーを起こ + し,Pythonからの例外を出力する.例えば\tplkword{desc}キーワードの出力に + \tplkwfilt{date}{isodate}フィルタを適用するのはいい考えとは言えない. + \end{note} %\subsection{Combining filters} diff -r 45ad9986748a -r 96437101a088 ja/todo.txt --- a/ja/todo.txt Mon Sep 22 01:42:57 2008 +0900 +++ b/ja/todo.txt Mon Sep 22 22:48:57 2008 +0900 @@ -14,7 +14,7 @@ mq.tex 100% preface.tex 100% srcinstall.tex 100% -template.tex 20% +template.tex 50% tour-basic.tex tour-merge.tex undo.tex 100%