# HG changeset patch # User Yoshiki Yazawa # Date 1222140444 -32400 # Node ID bc92b28fc970325edf012054071883235f6c7372 # Parent df4ac9043db037798cf03363335a9d236539aa88 finished template.tex diff -r df4ac9043db0 -r bc92b28fc970 ja/template.tex --- a/ja/template.tex Tue Sep 23 02:21:24 2008 +0900 +++ b/ja/template.tex Tue Sep 23 12:27:24 2008 +0900 @@ -185,7 +185,7 @@ \begin{itemize} %\item[\tplkword{author}] String. The unmodified author of the changeset. -\item[\tplkword{author}] 文字列.チェンジセットの著者がそのもの. +\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}. @@ -463,16 +463,14 @@ \item[\tplkwfilt{author}{person}] 任意のテキスト.\tplkword{author}キー ワードと合わせて使う場合もっとも有用.emailアドレスの前のテ - キストを抽出する.例えば``\Verb+Bryan O'Sullivan - +''は``\Verb+Bryan O'Sullivan+''となる. + キストを抽出する.例えば``\Verb+Bryan O'Sullivan +''は``\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{date}{rfc822date}] \tplkword{date}キーワード.日時を - emailヘッダと同じ形式で整形する.``\Verb+Mon, 04 Sep 2006 - 15:13:13 -0700+''のような文字列を生成する. + emailヘッダと同じ形式で整形する.``\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. @@ -515,8 +513,7 @@ \item[\tplkwfilt{author}{user}] 任意のテキスト.\tplkword{author}キーワー ドと共に使った場合に最も有用.emailアドレスからユーザ名の部 - 分を抜き出す.例えば``\Verb+Bryan O'Sullivan - +''は``\Verb+bos+''となる. + 分を抜き出す.例えば``\Verb+Bryan O'Sullivan +''は``\Verb+bos+''となる. \end{itemize} \begin{figure} @@ -596,124 +593,189 @@ %\subsection{The simplest of style files} \subsection{最も単純なスタイルファイル} -Our simple style file contains just one line: +%Our simple style file contains just one line: + +サンプルスタイルファイルはただの1行からなる: \interaction{template.simple.rev} -This tells Mercurial, ``if you're printing a changeset, use the text -on the right as the template''. +%This tells Mercurial, ``if you're printing a changeset, use the text +%on the right as the template''. + +これはMercurialに``チェンジセットを出力する時は右のテキストをテンプレート +として使え''という指示を与える. %\subsection{Style file syntax} \subsection{スタイルファイルの文法} -The syntax rules for a style file are simple. +%The syntax rules for a style file are simple. + +スタイルファイルの文法規則は単純である. \begin{itemize} -\item The file is processed one line at a time. +%\item The file is processed one line at a time. +\item ファイルは一度に1行ずつ処理される -\item Leading and trailing white space are ignored. +%\item Leading and trailing white space are ignored. +\item 前後の空白は無視される -\item Empty lines are skipped. +%\item Empty lines are skipped. +\item 空行はスキップされる -\item If a line starts with either of the characters ``\texttt{\#}'' or - ``\texttt{;}'', the entire line is treated as a comment, and skipped - as if empty. +%\item If a line starts with either of the characters ``\texttt{\#}'' or +% ``\texttt{;}'', the entire line is treated as a comment, and skipped +% as if empty. +\item 行が``\texttt{\#}''または``\texttt{;}''で始まる場合は,行全体がコ + メントとして扱われ,空白と同様にスキップされる. -\item A line starts with a keyword. This must start with an - alphabetic character or underscore, and can subsequently contain any - alphanumeric character or underscore. (In regexp notation, a - keyword must match \Verb+[A-Za-z_][A-Za-z0-9_]*+.) +%\item A line starts with a keyword. This must start with an +% alphabetic character or underscore, and can subsequently contain any +% alphanumeric character or underscore. (In regexp notation, a +% keyword must match \Verb+[A-Za-z_][A-Za-z0-9_]*+.) +\item 行はキーワードで始まる.必ずアルファベットかアンダースコアで始まる + 必要があり,後続の文字はアルファベット,数字,アンダースコアのいず + れかであってよい.(正規表現では\Verb+[A-Za-z_][A-Za-z0-9_]*+とマッ + チする) -\item The next element must be an ``\texttt{=}'' character, which can - be preceded or followed by an arbitrary amount of white space. +%\item The next element must be an ``\texttt{=}'' character, which can +% be preceded or followed by an arbitrary amount of white space. +\item 次の要素は文字``\texttt{=}''で,前後に空白が入っても良い. -\item If the rest of the line starts and ends with matching quote - characters (either single or double quote), it is treated as a - template body. +%\item If the rest of the line starts and ends with matching quote +% characters (either single or double quote), it is treated as a +% template body. +\item 数の釣り合ったシングルクォートまたはダブルクォートで括られる部分が + 続く場合はこれがテンプレートボディとして扱われる. -\item If the rest of the line \emph{does not} start with a quote - character, it is treated as the name of a file; the contents of this - file will be read and used as a template body. +%\item If the rest of the line \emph{does not} start with a quote +% character, it is treated as the name of a file; the contents of this +% file will be read and used as a template body. +\item 続く部分がクォート文字で始まらない場合はファイル名として扱われ,ファ + イルの内容がテンプレートボディとして使われる. + \end{itemize} %\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 -it, we'll mirror the usual process of developing a style file by -starting with something very simple, and walking through a series of -successively more complete examples. +%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 +%it, we'll mirror the usual process of developing a style file by +%starting with something very simple, and walking through a series of +%successively more complete examples. + +スタイルファイルの書き方を説明するためにいくつかの例題を挙げてみる.完全 +なスタイルファイルを用意してこれを説明するのではなく,とても単純な例から +始めて,だんだんと複雑な例に進むことでスタイルファイルの通常の開発プロセ +スを模倣してみる. %\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 -means, is actually quite useful. +%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 +%means, is actually quite useful. + +Mercurialがスタイルファイルで問題に直面すると,簡潔なエラーメッセージを表 +示する.このメッセージはその意味するところが分かっていればとても有益であ +る. \interaction{template.svnstyle.syntax.input} -Notice that \filename{broken.style} attempts to define a -\texttt{changeset} keyword, but forgets to give any content for it. -When instructed to use this style file, Mercurial promptly complains. +%Notice that \filename{broken.style} attempts to define a +%\texttt{changeset} keyword, but forgets to give any content for it. +%When instructed to use this style file, Mercurial promptly complains. + +\filename{broken.style}で\texttt{changeset}キーワードを定義しようとしてい +るが,定義の内容が全く与えられていない.このスタイルファイルを使おうとす +ると,Mercurialはすぐさまエラーを表示する. \interaction{template.svnstyle.syntax.error} -This error message looks intimidating, but it is not too hard to -follow. +%This error message looks intimidating, but it is not too hard to +%follow. + +このエラーメッセージは恐ろしげだが,対応するのはさほど難しくない. \begin{itemize} -\item The first component is simply Mercurial's way of saying ``I am - giving up''. +%\item The first component is simply Mercurial's way of saying ``I am +% giving up''. + \item 最初の部分は``ギブアップ''のMercurial的な表現である. \begin{codesample4} \textbf{abort:} broken.style:1: parse error \end{codesample4} -\item Next comes the name of the style file that contains the error. +%\item Next comes the name of the style file that contains the error. +\item 次にエラーのあるスタイルファイル名が表示される \begin{codesample4} abort: \textbf{broken.style}:1: parse error \end{codesample4} -\item Following the file name is the line number where the error was - encountered. +%\item Following the file name is the line number where the error was +% encountered. + \item ファイル名の後にエラーの起きた行番号が続く. \begin{codesample4} abort: broken.style:\textbf{1}: parse error \end{codesample4} -\item Finally, a description of what went wrong. +%\item Finally, a description of what went wrong. + \item 最後に問題点の説明が表示される \begin{codesample4} abort: broken.style:1: \textbf{parse error} \end{codesample4} - The description of the problem is not always clear (as in this - case), but even when it is cryptic, it is almost always trivial to - visually inspect the offending line in the style file and see what - is wrong. +% The description of the problem is not always clear (as in this +% case), but even when it is cryptic, it is almost always trivial to +% visually inspect the offending line in the style file and see what +% is wrong. +問題の説明は常に明快であるとは限らない.(この例のように.)しかし謎めい + ていたとしても,殆んどの場合,スタイルファイルの問題のある行を見 + ると,ごく些細な問題にすぎないものである. \end{itemize} %\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 -use the first revision in the repository. -\interaction{template.svnstyle.id} -This is not guaranteed to be unique, but it is nevertheless useful in -many cases. +%If you would like to be able to identify a Mercurial repository +%``fairly uniquely'' using a short string as an identifier, you can +%use the first revision in the repository. +%\interaction{template.svnstyle.id} + +%This is not guaranteed to be unique, but it is nevertheless useful in +%many cases. + +短い文字列を識別子に使ってMercurialリポジトリを特定したい場合は +リポジトリ内の最初のリビジョンを使うことができる. +\interaction{template.svnstyle.id} +これはユニークであることが保証されているわけではないが,多くの場合に有用 +であることはいうまでもない. + \begin{itemize} -\item It will not work in a completely empty repository, because such - a repository does not have a revision~zero. -\item Neither will it work in the (extremely rare) case where a - repository is a merge of two or more formerly independent - repositories, and you still have those repositories around. +%\item It will not work in a completely empty repository, because such +% a repository does not have a revision~zero. + \item 完全に空のリポジトリではこの方法は使えない.空のリポジトリにはリ + ビジョン~ゼロすら存在しないためである. + +%\item Neither will it work in the (extremely rare) case where a +% repository is a merge of two or more formerly independent +% repositories, and you still have those repositories around. + \item 独立した複数のリポジトリをマージしてリポジトリを作成し,これらの + リポジトリが依然として存在するなどの(きわめて稀な)場合はこの方 + 法は使えない. \end{itemize} -Here are some uses to which you could put this identifier: +%Here are some uses to which you could put this identifier: +この識別子の使用例を示す: \begin{itemize} -\item As a key into a table for a database that manages repositories - on a server. -\item As half of a \{\emph{repository~ID}, \emph{revision~ID}\} tuple. - Save this information away when you run an automated build or other - activity, so that you can ``replay'' the build later if necessary. +%\item As a key into a table for a database that manages repositories +% on a server. + \item サーバ上でリポジトリを管理するデータベース用のテーブルへのキーとして. + +%\item As half of a \{\emph{repository~ID}, \emph{revision~ID}\} tuple. +% Save this information away when you run an automated build or other +% activity, so that you can ``replay'' the build later if necessary. + \item \{\emph{repository~ID}, \emph{revision~ID}\}タプルの半分として.自 +動ビルドやその他の操作を行うときにこの情報をセーブしておき,後でビルドを +再現することが必要となったら``リプレイ''を行えるようにする. + \end{itemize} %\subsection{Mimicking Subversion's output} @@ -733,40 +795,71 @@ Subversionの出力スタイルはかなり単純なので,出力からファイルへhunkをコピー &ペーストし,Subversionが生成したテキストをテンプレートによって置換する -のは簡単である. \interaction{template.svnstyle.template} +のは簡単である. +\interaction{template.svnstyle.template} %There are a few small ways in which this template deviates from the %output produced by Subversion. +テンプレートによる出力がSubversionが生成する出力と異なる2, 3の例がある. + \begin{itemize} -\item Subversion prints a ``readable'' date (the ``\texttt{Wed, 27 Sep - 2006}'' in the example output above) in parentheses. Mercurial's - templating engine does not provide a way to display a date in this - format without also printing the time and time zone. -\item We emulate Subversion's printing of ``separator'' lines full of - ``\texttt{-}'' characters by ending the template with such a line. - We use the templating engine's \tplkword{header} keyword to print a - separator line as the first line of output (see below), thus - achieving similar output to Subversion. -\item Subversion's output includes a count in the header of the number - of lines in the commit message. We cannot replicate this in - Mercurial; the templating engine does not currently provide a filter - that counts the number of items it is passed. +%\item Subversion prints a ``readable'' date (the ``\texttt{Wed, 27 Sep +% 2006}'' in the example output above) in parentheses. Mercurial's +% templating engine does not provide a way to display a date in this +% format without also printing the time and time zone. + \item Subversionは中括弧で囲まれた``可読な''日時を出力する.(上の例では + ``\texttt{Wed, 27 Sep 2006}''.) Mercurialのテンプレートエンジン + はこのフォーマットで時刻とタイムゾーンを含まない形で日時を出力する + ことができない. + +%\item We emulate Subversion's printing of ``separator'' lines full of +% ``\texttt{-}'' characters by ending the template with such a line. +% We use the templating engine's \tplkword{header} keyword to print a +% separator line as the first line of output (see below), thus +% achieving similar output to Subversion. + \item Subversionの``セパレータ''行の出力をテンプレートを行幅一杯の + ``\texttt{-}''文字で終えることでエミュレートしている.テンプレート + エンジンの\tplkword{header}キーワードを使ってセパレータ行を出力の + 最初の行として出力する.(下記を参照.)これによってSubversionと似 + 通った出力を行っている. + +%\item Subversion's output includes a count in the header of the number +% of lines in the commit message. We cannot replicate this in +% Mercurial; the templating engine does not currently provide a filter +% that counts the number of items it is passed. + \item Subversionの出力はヘッダ内にコミットメッセージの行数のカウントを + 含んでいる.Mercurialではこれを再現することはできない.テンプレー + トエンジンは現状では渡されたアイテムを数えるフィルタを作ることが + できない. \end{itemize} -It took me no more than a minute or two of work to replace literal -text from an example of Subversion's output with some keywords and -filters to give the template above. The style file simply refers to -the template. +%It took me no more than a minute or two of work to replace literal +%text from an example of Subversion's output with some keywords and +%filters to give the template above. The style file simply refers to +%the template. + +Subversionの出力を参考に,テキストを置換するキーワード,テンプレートの入っ +たフィルタを準備するのにはほんの1,2分しかかからなかった.スタイルファ +イルは単純にテンプレートを参照するのみである + \interaction{template.svnstyle.style} -We could have included the text of the template file directly in the -style file by enclosing it in quotes and replacing the newlines with -``\texttt{\\n}'' sequences, but it would have made the style file too -difficult to read. Readability is a good guide when you're trying to -decide whether some text belongs in a style file, or in a template -file that the style file points to. If the style file will look too -big or cluttered if you insert a literal piece of text, drop it into a -template instead. +%We could have included the text of the template file directly in the +%style file by enclosing it in quotes and replacing the newlines with +%``\texttt{\\n}'' sequences, but it would have made the style file too +%difficult to read. Readability is a good guide when you're trying to +%decide whether some text belongs in a style file, or in a template +%file that the style file points to. If the style file will look too +%big or cluttered if you insert a literal piece of text, drop it into a +%template instead. + +テンプレートファイルのテキストをクォートで括り,改行を``\texttt{\\n}''で +エスケープすることでスタイルファイルに直接追加することも可能ではある.し +かしそうした場合,スタイルファイルがほとんど読めないほど複雑になってしま +うだろう.テキストをスタイルファイルに入れるか,スタイルファイルから呼ば +れるテンプレートファイルに入れるかは,可読性を考慮して決定すべきである. +もしテキストを追加したことでスタイルファイルが大きくなり過ぎたり,乱雑に +なったりした場合は,テンプレートへの移動を考慮するとよい. %%% Local Variables: %%% mode: yatex diff -r df4ac9043db0 -r bc92b28fc970 ja/todo.txt --- a/ja/todo.txt Tue Sep 23 02:21:24 2008 +0900 +++ b/ja/todo.txt Tue Sep 23 12:27:24 2008 +0900 @@ -14,7 +14,7 @@ mq.tex 100% preface.tex 100% srcinstall.tex 100% -template.tex 50% +template.tex 100% tour-basic.tex tour-merge.tex undo.tex 100%