# HG changeset patch # User Yoshiki Yazawa # Date 1222015377 -32400 # Node ID 45ad9986748a2cf67030dc83c22e544ba441c1c6 # Parent 81116699a5101df950af2ec6a3c1251a334569e5 started template.tex diff -r 81116699a510 -r 45ad9986748a ja/template.tex --- a/ja/template.tex Wed Sep 03 15:23:41 2008 +0900 +++ b/ja/template.tex Mon Sep 22 01:42:57 2008 +0900 @@ -1,158 +1,277 @@ -\chapter{Customising the output of Mercurial} +%\chapter{Customising the output of Mercurial} +\chapter{Mercurialの出力のカスタマイズ} \label{chap:template} -Mercurial provides a powerful mechanism to let you control how it -displays information. The mechanism is based on templates. You can -use templates to generate specific output for a single command, or to -customise the entire appearance of the built-in web interface. +%Mercurial provides a powerful mechanism to let you control how it +%displays information. The mechanism is based on templates. You can +%use templates to generate specific output for a single command, or to +%customise the entire appearance of the built-in web interface. -\section{Using precanned output styles} +Mercurialには情報の表示をコントロールするための強力な機構がある.この機構 +はテンプレートをベースとしている.テンプレートによってあるコマンドから特 +別の出力を行ったり,内蔵のウェブインタフェースの見た目をカスタマイズする +ことができる. + +%\section{Using precanned output styles} +\section{用意された出力スタイルの利用} \label{sec:style} -Packaged with Mercurial are some output styles that you can use -immediately. A style is simply a precanned template that someone -wrote and installed somewhere that Mercurial can find. +%Packaged with Mercurial are some output styles that you can use +%immediately. A style is simply a precanned template that someone +%wrote and installed somewhere that Mercurial can find. -Before we take a look at Mercurial's bundled styles, let's review its -normal output. +すぐに使うことのできるいくつかのスタイルがMercurialに同梱されている.スタ +イルとは缶詰されたテンプレートであり, Mercurialのインストールされたどこ +かのマシンで誰かが書いてインストールしたものである. + +%Before we take a look at Mercurial's bundled styles, let's review its +%normal output. + +Mercurial同梱のスタイルを見る前に,通常の出力を見てみよう. \interaction{template.simple.normal} -This is somewhat informative, but it takes up a lot of space---five -lines of output per changeset. The \texttt{compact} style reduces -this to three lines, presented in a sparse manner. +%This is somewhat informative, but it takes up a lot of space---five +%lines of output per changeset. The \texttt{compact} style reduces +%this to three lines, presented in a sparse manner. + +この出力には有益な情報が含まれているが,1つのチェンジセット毎に5行を使う +など,多くのスペースを費やす.\texttt{compact}スタイルは疎らな方法を使う +ことでこれを3行に減らす. \interaction{template.simple.compact} -The \texttt{changelog} style hints at the expressive power of -Mercurial's templating engine. This style attempts to follow the GNU -Project's changelog guidelines\cite{web:changelog}. +%The \texttt{changelog} style hints at the expressive power of +%Mercurial's templating engine. This style attempts to follow the GNU +%Project's changelog guidelines\cite{web:changelog}. + +\texttt{changelog}スタイルはMercurialのテンプレートエンジンの威力を知るい +い例である.このスタイルはGNUプロジェクトのchangelogガイドライン +\cite{web:changelog}に従おうとする. \interaction{template.simple.changelog} -You will not be shocked to learn that Mercurial's default output style -is named \texttt{default}. +%You will not be shocked to learn that Mercurial's default output style +%is named \texttt{default}. + +Mercurialのデフォルト出力スタイルが\texttt{default}と名付けられているの +は驚くに値しない. -\subsection{Setting a default style} +%\subsection{Setting a default style} +\subsection{デフォルトスタイルの設定} -You can modify the output style that Mercurial will use for every -command by editing your \hgrc\ file, naming the style you would -prefer to use. +%You can modify the output style that Mercurial will use for every +%command by editing your \hgrc file, naming the style you would +%prefer to use. + +Mercurialの全てのコマンドで用いられる出力スタイルは\hgrcファイルを編集す +ることで設定でき,好きな名前を付けることができる. \begin{codesample2} [ui] style = compact \end{codesample2} -If you write a style of your own, you can use it by either providing -the path to your style file, or copying your style file into a -location where Mercurial can find it (typically the \texttt{templates} -subdirectory of your Mercurial install directory). +%If you write a style of your own, you can use it by either providing +%the path to your style file, or copying your style file into a +%location where Mercurial can find it (typically the \texttt{templates} +%subdirectory of your Mercurial install directory). + +自分でスタイルを書いたときは,スタイルファイルのパスを追加したり,ファイ +ルをMercurialが発見できる場所(典型的には,Mercurialのインストールディレク +トリの\texttt{templates}サブディレクトリ)にコピーすることで利用可能にな +る. -\section{Commands that support styles and templates} +%\section{Commands that support styles and templates} +\section{スタイルとテンプレートをサポートするコマンド} -All of Mercurial's ``\texttt{log}-like'' commands let you use styles -and templates: \hgcmd{incoming}, \hgcmd{log}, \hgcmd{outgoing}, and -\hgcmd{tip}. +%All of Mercurial's ``\texttt{log}-like'' commands let you use styles +%and templates: \hgcmd{incoming}, \hgcmd{log}, \hgcmd{outgoing}, and +%\hgcmd{tip}. + +Mercurialの``\texttt{log}系''の全てのコマンド: \hgcmd{incoming}, +\hgcmd{log}, \hgcmd{outgoing}, および\hgcmd{tip}はスタイルとテンプレート +を利用している. -As I write this manual, these are so far the only commands that -support styles and templates. Since these are the most important -commands that need customisable output, there has been little pressure -from the Mercurial user community to add style and template support to -other commands. +%As I write this manual, these are so far the only commands that +%support styles and templates. Since these are the most important +%commands that need customisable output, there has been little pressure +%from the Mercurial user community to add style and template support to +%other commands. + +このマニュアルで書いているように,これまでのところ,これらのコマンドだけ +がスタイルとテンプレートをサポートしている.これらがカスタマイズ可能な出 +力が必要な最も重要なコマンドであるため, Mercurialのユーザコミュニティか +ら他のコマンドにスタイルとテンプレートサポートを適用かのうにせよというプ +レッシャーはほとんどない. -\section{The basics of templating} +%\section{The basics of templating} +\section{テンプレートの基本} + +%At its simplest, a Mercurial template is a piece of text. Some of the +%text never changes, while other parts are \emph{expanded}, or replaced +%with new text, when necessary. -At its simplest, a Mercurial template is a piece of text. Some of the -text never changes, while other parts are \emph{expanded}, or replaced -with new text, when necessary. +最も単純なMercurialテンプレートはテキスト片である.テキストのある部分は不 +変で,他の部分は必要に応じて\emph{展開}されるたり新しいテキストに置換され +る. -Before we continue, let's look again at a simple example of -Mercurial's normal output. +%Before we continue, let's look again at a simple example of +%Mercurial's normal output. + +さらに続ける前にMercurial標準出力の例をもう一度見てみよう. \interaction{template.simple.normal} -Now, let's run the same command, but using a template to change its -output. +%Now, let's run the same command, but using a template to change its +%output. + +ここで同じコマンドを出力を変化させるためにテンプレートを使ってみよう. \interaction{template.simple.simplest} -The example above illustrates the simplest possible template; it's -just a piece of static text, printed once for each changeset. The -\hgopt{log}{--template} option to the \hgcmd{log} command tells -Mercurial to use the given text as the template when printing each -changeset. +%The example above illustrates the simplest possible template; it's +%just a piece of static text, printed once for each changeset. The +%\hgopt{log}{--template} option to the \hgcmd{log} command tells +%Mercurial to use the given text as the template when printing each +%changeset. + +上の例は最も単純なテンプレートを示した; 静的なテキストだけからなり,各チェ +ンジセットについて一度だけ出力を行う.\hgcmd{log}コマンドに +\hgopt{log}{--template}オプションを使うとMercurialは各々のチェンジセット +を出力するときに,与えられたテキストをテンプレートとして用いる. -Notice that the template string above ends with the text -``\Verb+\n+''. This is an \emph{escape sequence}, telling Mercurial -to print a newline at the end of each template item. If you omit this -newline, Mercurial will run each piece of output together. See -section~\ref{sec:template:escape} for more details of escape sequences. +%Notice that the template string above ends with the text +%``\Verb+\n+''. This is an \emph{escape sequence}, telling Mercurial +%to print a newline at the end of each template item. If you omit this +%newline, Mercurial will run each piece of output together. See +%section~\ref{sec:template:escape} for more details of escape sequences. -A template that prints a fixed string of text all the time isn't very -useful; let's try something a bit more complex. +テンプレート文字列は``\Verb+\n+''で終ることに注意.これはMercurialにテン +プレートの各要素の末尾に改行を出力するよう指示する\emph{エスケープシーケ +ンス}である.この改行を省略するとMercurialは各要素を繋げて出力する.エス +ケープシーケンスのより詳細な説明については~\ref{sec:template:escape}節を +参照のこと. + +%A template that prints a fixed string of text all the time isn't very +%useful; let's try something a bit more complex. + +常に固定文字列を出力するテンプレートはあまり有用であるとは言えない.もう +少し込み入ったテンプレートを試そう. \interaction{template.simple.simplesub} -As you can see, the string ``\Verb+{desc}+'' in the template has been -replaced in the output with the description of each changeset. Every -time Mercurial finds text enclosed in curly braces (``\texttt{\{}'' -and ``\texttt{\}}''), it will try to replace the braces and text with -the expansion of whatever is inside. To print a literal curly brace, -you must escape it, as described in section~\ref{sec:template:escape}. +%As you can see, the string ``\Verb+{desc}+'' in the template has been +%replaced in the output with the description of each changeset. Every +%time Mercurial finds text enclosed in curly braces (``\texttt{\{}'' +%and ``\texttt{\}}''), it will try to replace the braces and text with +%the expansion of whatever is inside. To print a literal curly brace, +%you must escape it, as described in section~\ref{sec:template:escape}. -\section{Common template keywords} +テンプレート内の``\Verb+{desc}+''という文字列は出力では,各々のチェンジセッ +トの説明に置換される.Mercurialは中括弧(``\texttt{\{}''と +``\texttt{\}}'')で囲まれたテキストを見つけると中括弧とテキストを内部のテ +キストを展開したものに置換しようと試みる.文字として中括弧を印字したい場 +合は~\ref{sec:template:escape}節で示すようにエスケープする必要がある. + +%\section{Common template keywords} +\section{テンプレートの共通キーワード} \label{sec:template:keyword} -You can start writing simple templates immediately using the keywords -below. +%You can start writing simple templates immediately using the keywords +%below. + +単純なテンプレートは以下のようなキーワードを使って直ちに書くことができる. \begin{itemize} -\item[\tplkword{author}] String. The unmodified author of the changeset. -\item[\tplkword{branches}] String. The name of the branch on which - the changeset was committed. Will be empty if the branch name was - \texttt{default}. -\item[\tplkword{date}] Date information. The date when the changeset - was committed. This is \emph{not} human-readable; you must pass it - through a filter that will render it appropriately. See - section~\ref{sec:template:filter} for more information on filters. - The date is expressed as a pair of numbers. The first number is a - Unix UTC timestamp (seconds since January 1, 1970); the second is - the offset of the committer's timezone from UTC, in seconds. -\item[\tplkword{desc}] String. The text of the changeset description. -\item[\tplkword{files}] List of strings. All files modified, added, or - removed by this changeset. -\item[\tplkword{file\_adds}] List of strings. Files added by this - changeset. -\item[\tplkword{file\_dels}] List of strings. Files removed by this - changeset. -\item[\tplkword{node}] String. The changeset identification hash, as a - 40-character hexadecimal string. -\item[\tplkword{parents}] List of strings. The parents of the - changeset. -\item[\tplkword{rev}] Integer. The repository-local changeset revision - number. -\item[\tplkword{tags}] List of strings. Any tags associated with the - changeset. +%\item[\tplkword{author}] String. The unmodified author of the changeset. +\item[\tplkword{author}] 文字列.チェンジセットの著者がそのもの. +%\item[\tplkword{branches}] String. The name of the branch on which +% the changeset was committed. Will be empty if the branch name was +% \texttt{default}. +\item[\tplkword{branches}] 文字列.チェンジセットがコミットされたブラン + チの名前.ブランチ名が\texttt{default}の場合は + 空欄となる. +%\item[\tplkword{date}] Date information. The date when the changeset +% was committed. This is \emph{not} human-readable; you must pass it +% through a filter that will render it appropriately. See +% section~\ref{sec:template:filter} for more information on filters. +% The date is expressed as a pair of numbers. The first number is a +% Unix UTC timestamp (seconds since January 1, 1970); the second is +% the offset of the committer's timezone from UTC, in seconds. +\item[\tplkword{date}] 日時情報.チェンジセットがコミットされた日時.これ + は人間の可読な形式では\emph{ない}.必ず適切なフィ + ルタを呼び出して変換する必要がある.フィルタに関 + するより詳細な説明は~\ref{sec:template:filter} + 節を参照のこと.日時は2つの数字の組み合わせで表 + される.最初の数字はUTCでのUnixタイムスタンプ + (1970年1月1日からの秒数)で,2番目の数字はコミッ + タのタイムゾーンのUTCからの時差を秒数で表したも + のである. +%\item[\tplkword{desc}] String. The text of the changeset description. +\item[\tplkword{desc}] 文字列.チェンジセットの説明文. + +%\item[\tplkword{files}] List of strings. All files modified, added, or +% removed by this changeset. +\item[\tplkword{files}] 文字列のリスト.このチェンジセットで変更,追加, + 削除された全てのファイルの名前. + +%\item[\tplkword{file\_adds}] List of strings. Files added by this +% changeset. +\item[\tplkword{file\_adds}] 文字列のリスト.このチェンジセットで追加さ + れたファイルの名前. + +%\item[\tplkword{file\_dels}] List of strings. Files removed by this +% changeset. +\item[\tplkword{file\_dels}] 文字列のリスト.このチェンジセットで削除さ + れたファイルの名前. + +%\item[\tplkword{node}] String. The changeset identification hash, as a +% 40-character hexadecimal string. +\item[\tplkword{node}] 文字列.チェンジセットの識別ハッシュを40文字の16 + 進数で示したもの. + +%\item[\tplkword{parents}] List of strings. The parents of the +% changeset. +\item[\tplkword{parents}] 文字列のリスト.チェンジセットの親. + +%\item[\tplkword{rev}] Integer. The repository-local changeset revision +% number. +\item[\tplkword{rev}] 整数.リポジトリローカルのチェンジセットリビジョン + 番号. + +%\item[\tplkword{tags}] List of strings. Any tags associated with the +% changeset. +\item[\tplkword{tags}] 文字列のリスト.チェンジセットに関連づけられた任 + 意のタグ. \end{itemize} -A few simple experiments will show us what to expect when we use these -keywords; you can see the results in -figure~\ref{fig:template:keywords}. +%A few simple experiments will show us what to expect when we use these +%keywords; you can see the results in +%figure~\ref{fig:template:keywords}. + +いくつか試してみればこれらのキーワードにどのような効果があるのかを知るこ +とができる.結果を図~\ref{fig:template:keywords}に示す. \begin{figure} \interaction{template.simple.keywords} - \caption{Template keywords in use} +% \caption{Template keywords in use} + \caption{テンプレートキーワードの使用} \label{fig:template:keywords} \end{figure} -As we noted above, the date keyword does not produce human-readable -output, so we must treat it specially. This involves using a -\emph{filter}, about which more in section~\ref{sec:template:filter}. +%As we noted above, the date keyword does not produce human-readable +%output, so we must treat it specially. This involves using a +%\emph{filter}, about which more in section~\ref{sec:template:filter}. + +既に述べたように,dateキーワードは可読な出力を行わないため,特別な取り扱 +いが必要である.その目的で\emph{filter}を使用するが,より詳細に +は~\ref{sec:template:filter}節で取り扱う. \interaction{template.simple.datekeyword} -\section{Escape sequences} +%\section{Escape sequences} +\section{エスケープシーケンス} \label{sec:template:escape} Mercurial's templating engine recognises the most commonly used escape @@ -175,7 +294,8 @@ a literal ``\Verb+\+'', ``\Verb+{+'', or ``\Verb+{+'' character, you must escape it. -\section{Filtering keywords to change their results} +%\section{Filtering keywords to change their results} +\section{結果を改変するフィルタキーワード} \label{sec:template:filter} Some of the results of template expansion are not immediately easy to @@ -275,7 +395,8 @@ into the \tplkwfilt{date}{isodate} filter is not a good idea. \end{note} -\subsection{Combining filters} +%\subsection{Combining filters} +\subsection{組み合わせフィルタ} It is easy to combine filters to yield output in the form you would like. The following chain of filters tidies up a description, then @@ -296,7 +417,8 @@ \Verb+tabindent|fill68+. -\section{From templates to styles} +%\section{From templates to styles} +\section{テンプレートからスタイルへ} A command line template provides a quick and simple way to format some output. Templates can become verbose, though, and it's useful to be @@ -307,7 +429,8 @@ templating engine in ways that are not possible using the command line \hgopt{log}{--template} option. -\subsection{The simplest of style files} +%\subsection{The simplest of style files} +\subsection{最も単純なスタイルファイル} Our simple style file contains just one line: @@ -316,7 +439,8 @@ This tells Mercurial, ``if you're printing a changeset, use the text on the right as the template''. -\subsection{Style file syntax} +%\subsection{Style file syntax} +\subsection{スタイルファイルの文法} The syntax rules for a style file are simple. @@ -348,7 +472,8 @@ file will be read and used as a template body. \end{itemize} -\section{Style files by example} +%\section{Style files by example} +\section{スタイルファイルの例} To illustrate how to write a style file, we will construct a few by example. Rather than provide a complete style file and walk through @@ -356,7 +481,8 @@ starting with something very simple, and walking through a series of successively more complete examples. -\subsection{Identifying mistakes in style files} +%\subsection{Identifying mistakes in style files} +\subsection{スタイルファイルでの誤りを特定する} If Mercurial encounters a problem in a style file you are working on, it prints a terse error message that, once you figure out what it @@ -401,7 +527,8 @@ is wrong. \end{itemize} -\subsection{Uniquely identifying a repository} +%\subsection{Uniquely identifying a repository} +\subsection{リポジトリの特定} If you would like to be able to identify a Mercurial repository ``fairly uniquely'' using a short string as an identifier, you can @@ -425,20 +552,28 @@ activity, so that you can ``replay'' the build later if necessary. \end{itemize} -\subsection{Mimicking Subversion's output} +%\subsection{Mimicking Subversion's output} +\subsection{Subversion出力の模倣} -Let's try to emulate the default output format used by another -revision control tool, Subversion. +%Let's try to emulate the default output format used by another +%revision control tool, Subversion. +%\interaction{template.svnstyle.short} + +別のバージョン管理ツールであるSubversionの出力をエミュレートしてみよう. \interaction{template.svnstyle.short} -Since Subversion's output style is fairly simple, it is easy to -copy-and-paste a hunk of its output into a file, and replace the text -produced above by Subversion with the template values we'd like to see -expanded. -\interaction{template.svnstyle.template} +%Since Subversion's output style is fairly simple, it is easy to +%copy-and-paste a hunk of its output into a file, and replace the text +%produced above by Subversion with the template values we'd like to see +%expanded. -There are a few small ways in which this template deviates from the -output produced by Subversion. +Subversionの出力スタイルはかなり単純なので,出力からファイルへhunkをコピー +&ペーストし,Subversionが生成したテキストをテンプレートによって置換する +のは簡単である. \interaction{template.svnstyle.template} + +%There are a few small ways in which this template deviates from the +%output produced by Subversion. + \begin{itemize} \item Subversion prints a ``readable'' date (the ``\texttt{Wed, 27 Sep 2006}'' in the example output above) in parentheses. Mercurial's @@ -469,7 +604,7 @@ big or cluttered if you insert a literal piece of text, drop it into a template instead. -%%% Local Variables: +%%% Local Variables: %%% mode: yatex %%% TeX-master: "00book" -%%% End: +%%% End: diff -r 81116699a510 -r 45ad9986748a ja/todo.txt --- a/ja/todo.txt Wed Sep 03 15:23:41 2008 +0900 +++ b/ja/todo.txt Mon Sep 22 01:42:57 2008 +0900 @@ -14,7 +14,7 @@ mq.tex 100% preface.tex 100% srcinstall.tex 100% -template.tex +template.tex 20% tour-basic.tex tour-merge.tex undo.tex 100%