hgbook

diff es/template.tex @ 470:012631b248de

translated some templates chapter paragraphs
author Igor Támara <igor@tamarapatino.org>
date Sun Dec 28 00:27:39 2008 -0500 (2008-12-28)
parents b05e35d641e4
children 1b8b19825994
line diff
     1.1 --- a/es/template.tex	Fri Nov 07 21:42:57 2008 -0500
     1.2 +++ b/es/template.tex	Sun Dec 28 00:27:39 2008 -0500
     1.3 @@ -1,144 +1,153 @@
     1.4 -\chapter{Customising the output of Mercurial}
     1.5 +\chapter{Personalizar los mensajes de Mercurial}
     1.6  \label{chap:template}
     1.7  
     1.8 -Mercurial provides a powerful mechanism to let you control how it
     1.9 -displays information.  The mechanism is based on templates.  You can
    1.10 -use templates to generate specific output for a single command, or to
    1.11 -customise the entire appearance of the built-in web interface.
    1.12 -
    1.13 -\section{Using precanned output styles}
    1.14 +Mercurial provee un poderoso mecanismo que permite controlar como
    1.15 +despliega la información.  El mecanismo se basa en plantillas.  Puede
    1.16 +usar plantillas para generar salida específica para una orden
    1.17 +particular o para especificar la visualización completa de la interfaz
    1.18 +web embebida.
    1.19 +
    1.20 +\section{Usar estilos que vienen con Mercurial}
    1.21  \label{sec:style}
    1.22  
    1.23 -Packaged with Mercurial are some output styles that you can use
    1.24 -immediately.  A style is simply a precanned template that someone
    1.25 -wrote and installed somewhere that Mercurial can find.
    1.26 -
    1.27 -Before we take a look at Mercurial's bundled styles, let's review its
    1.28 -normal output.
    1.29 +Hay ciertos estilos listos que vienen con Mercurial.  Un estilo es
    1.30 +simplemente una plantilla predeterminada que alguien escribió e
    1.31 +instaló en un sitio en el cual Mercurial puede encontrarla.
    1.32 +
    1.33 +Antes de dar un vistazo a los estilos que trae Mercurial, revisemos su
    1.34 +salida usual.
    1.35  
    1.36  \interaction{template.simple.normal}
    1.37  
    1.38 -This is somewhat informative, but it takes up a lot of space---five
    1.39 -lines of output per changeset.  The \texttt{compact} style reduces
    1.40 -this to three lines, presented in a sparse manner.
    1.41 +Es en cierta medida informativa, pero ocupa mucho espacio---cinco
    1.42 +líneas de salida por cada conjunto de cambios.  El estilo
    1.43 +\texttt{compact} lo reduce a tres líneas, presentadas de forma
    1.44 +suscinta.
    1.45  
    1.46  \interaction{template.simple.compact}
    1.47  
    1.48 -The \texttt{changelog} style hints at the expressive power of
    1.49 -Mercurial's templating engine.  This style attempts to follow the GNU
    1.50 -Project's changelog guidelines\cite{web:changelog}.
    1.51 +El estilo de la \texttt{bitácora de cambios} vislumbra el poder
    1.52 +expresivo del sistema de plantillas de Mercurial.  Este estilo busca
    1.53 +seguir los estándares de bitácora de cambios del proyecto
    1.54 +GNU\cite{web:changelog}.
    1.55  
    1.56  \interaction{template.simple.changelog}
    1.57  
    1.58 -You will not be shocked to learn that Mercurial's default output style
    1.59 -is named \texttt{default}.
    1.60 -
    1.61 -\subsection{Setting a default style}
    1.62 -
    1.63 -You can modify the output style that Mercurial will use for every
    1.64 -command by editing your \hgrc\ file, naming the style you would
    1.65 -prefer to use.
    1.66 +No es una sorpresa que el estilo predeterminado de Mercurial se llame
    1.67 +\texttt{default}\ndt{predeterminado}.
    1.68 +
    1.69 +\subsection{Especificar un estilo predeterminado}
    1.70 +
    1.71 +Puede modificar el estilo de presentación que Mercurial usará para
    1.72 +toda orden vía el fichero \hgrc\, indicando el estilo que prefiere
    1.73 +usar.
    1.74  
    1.75  \begin{codesample2}
    1.76    [ui]
    1.77    style = compact
    1.78  \end{codesample2}
    1.79  
    1.80 -If you write a style of your own, you can use it by either providing
    1.81 -the path to your style file, or copying your style file into a
    1.82 -location where Mercurial can find it (typically the \texttt{templates}
    1.83 -subdirectory of your Mercurial install directory).
    1.84 -
    1.85 -\section{Commands that support styles and templates}
    1.86 -
    1.87 -All of Mercurial's ``\texttt{log}-like'' commands let you use styles
    1.88 -and templates: \hgcmd{incoming}, \hgcmd{log}, \hgcmd{outgoing}, and
    1.89 -\hgcmd{tip}.
    1.90 -
    1.91 -As I write this manual, these are so far the only commands that
    1.92 -support styles and templates.  Since these are the most important
    1.93 -commands that need customisable output, there has been little pressure
    1.94 -from the Mercurial user community to add style and template support to
    1.95 -other commands.
    1.96 -
    1.97 -\section{The basics of templating}
    1.98 -
    1.99 -At its simplest, a Mercurial template is a piece of text.  Some of the
   1.100 -text never changes, while other parts are \emph{expanded}, or replaced
   1.101 -with new text, when necessary.
   1.102 -
   1.103 -Before we continue, let's look again at a simple example of
   1.104 -Mercurial's normal output.
   1.105 +Si escribe un estilo, puede usarlo bien sea proveyendo la ruta a su
   1.106 +fichero de estilo o copiando su fichero de estilo a un lugar en el
   1.107 +cual Mercurial pueda encontrarlo(típicamente el subdirectorio
   1.108 +\texttt{templates} de su directorio de instalación de Mercurial).
   1.109 +
   1.110 +\section{Órdenes que soportan estilos y plantillas}
   1.111 +
   1.112 +Todas las órdenes de Mercurial``relacionadas con \texttt{log}'' le
   1.113 +permiten usar estilos y plantillas: \hgcmd{incoming}, \hgcmd{log},
   1.114 +\hgcmd{outgoing} y \hgcmd{tip}.
   1.115 +
   1.116 +Al momento de la escritura del manual estas son las únicas órdenes que
   1.117 +soportan estilos y plantillas.  Dado que son las órdenes más
   1.118 +importantes que necesitan personalización, no ha habido muchas
   1.119 +solicitudes desde la comunidad de usuarios de Mercurial para añadir
   1.120 +soporte de plantillas y estilos a otras órdenes.
   1.121 +
   1.122 +\section{Cuestiones básicas de plantillas}
   1.123 +
   1.124 +Una plantilla de Mercurial es sencillamente una pieza de texto.
   1.125 +Cierta porción nunca cambia, otras partes se \emph{expanden}, o
   1.126 +reemplazan con texto nuevo cuando es necesario.
   1.127 +
   1.128 +Antes de continuar, veamos de nuevo un ejemplo sencillo de la salida
   1.129 +usual de Mercurial:
   1.130  
   1.131  \interaction{template.simple.normal}
   1.132  
   1.133 -Now, let's run the same command, but using a template to change its
   1.134 -output.
   1.135 +Ahora, ejecutemos la misma orden, pero usemos una plantilla para
   1.136 +modificar su salida:
   1.137  
   1.138  \interaction{template.simple.simplest}
   1.139  
   1.140 -The example above illustrates the simplest possible template; it's
   1.141 -just a piece of static text, printed once for each changeset.  The
   1.142 -\hgopt{log}{--template} option to the \hgcmd{log} command tells
   1.143 -Mercurial to use the given text as the template when printing each
   1.144 -changeset.
   1.145 -
   1.146 -Notice that the template string above ends with the text
   1.147 -``\Verb+\n+''.  This is an \emph{escape sequence}, telling Mercurial
   1.148 -to print a newline at the end of each template item.  If you omit this
   1.149 -newline, Mercurial will run each piece of output together.  See
   1.150 -section~\ref{sec:template:escape} for more details of escape sequences.
   1.151 -
   1.152 -A template that prints a fixed string of text all the time isn't very
   1.153 -useful; let's try something a bit more complex.
   1.154 +El ejemplo anterior ilustra la plantilla más sencilla posible;  es
   1.155 +solamente una porción estática de código que se imprime una vez por
   1.156 +cada conjunto de cambios.  La opción \hgopt{log}{--template} de la
   1.157 +orden \hgcmd{log} indica a Mercurial usar el texto dado como la
   1.158 +plantilla cuando se imprime cada conjunto de cambios.
   1.159 +
   1.160 +Observe que la cadena de plantilla anterior termina con el texto
   1.161 +``\Verb+\n+''.  Es una \emph{secuencia de control}, que le indica a
   1.162 +Mercurial imprimira una nueva línea al final de cada objeto de la
   1.163 +plantilla.  Si omite esta nueva línea, Mercurial colocará cada pieza
   1.164 +de salida seguida.  Si desea más detalles acerca de secuencias de
   1.165 +control, vea la sección~\ref{sec:template:escape}.
   1.166 +
   1.167 +Una plantilla que imprime una cadena fija de texto siempre no es muy
   1.168 +útil; intentemos algo un poco más complejo.
   1.169  
   1.170  \interaction{template.simple.simplesub}
   1.171  
   1.172 -As you can see, the string ``\Verb+{desc}+'' in the template has been
   1.173 -replaced in the output with the description of each changeset.  Every
   1.174 -time Mercurial finds text enclosed in curly braces (``\texttt{\{}''
   1.175 -and ``\texttt{\}}''), it will try to replace the braces and text with
   1.176 -the expansion of whatever is inside.  To print a literal curly brace,
   1.177 -you must escape it, as described in section~\ref{sec:template:escape}.
   1.178 -
   1.179 -\section{Common template keywords}
   1.180 +Como puede ver, la cadena ``\Verb+{desc}+'' en la plantilla ha sido
   1.181 +reemplazada en la salida con la descricipción de cada conjunto de
   1.182 +cambios.  Cada vez que Mercurial encuentra texto encerrado entre
   1.183 +corchetes(``\texttt{\{}'' y ``\texttt{\}}''), intentará reemplazar los
   1.184 +corchetes y el texto con la expansión de lo que sea está adentro.
   1.185 +Para imprimir un corchete de forma literal, debe escaparlo, como se
   1.186 +describe en la sección~\ref{sec:template:escape}.
   1.187 +
   1.188 +\section{Palabras claves más comunes en las plantillas}
   1.189  \label{sec:template:keyword}
   1.190  
   1.191 -You can start writing simple templates immediately using the keywords
   1.192 -below.
   1.193 -
   1.194 -\begin{itemize}
   1.195 -\item[\tplkword{author}] String.  The unmodified author of the changeset.
   1.196 -\item[\tplkword{branches}] String.  The name of the branch on which
   1.197 -  the changeset was committed.  Will be empty if the branch name was
   1.198 +Puede empezar a escribir plantillas sencillas rápidamente con las
   1.199 +palabras claves descritas a continuación:
   1.200 +
   1.201 +\begin{itemize}
   1.202 +\item[\tplkword{author}] Cadena.  El autor NO modificado del conjunto
   1.203 +  de cambios.
   1.204 +\item[\tplkword{branches}] Cadena.  El nombre de la rama en la cual se
   1.205 +  consignó el conjunto de cambios.  Será vacía si el nombre de la rama es
   1.206    \texttt{default}.
   1.207 -\item[\tplkword{date}] Date information.  The date when the changeset
   1.208 -  was committed.  This is \emph{not} human-readable; you must pass it
   1.209 -  through a filter that will render it appropriately.  See
   1.210 -  section~\ref{sec:template:filter} for more information on filters.
   1.211 -  The date is expressed as a pair of numbers.  The first number is a
   1.212 -  Unix UTC timestamp (seconds since January 1, 1970); the second is
   1.213 -  the offset of the committer's timezone from UTC, in seconds.
   1.214 -\item[\tplkword{desc}] String.  The text of the changeset description.
   1.215 -\item[\tplkword{files}] List of strings.  All files modified, added, or
   1.216 -  removed by this changeset.
   1.217 -\item[\tplkword{file\_adds}] List of strings.  Files added by this
   1.218 -  changeset.
   1.219 -\item[\tplkword{file\_dels}] List of strings.  Files removed by this
   1.220 -  changeset.
   1.221 -\item[\tplkword{node}] String.  The changeset identification hash, as a
   1.222 -  40-character hexadecimal string.
   1.223 -\item[\tplkword{parents}] List of strings.  The parents of the
   1.224 -  changeset.
   1.225 -\item[\tplkword{rev}] Integer.  The repository-local changeset revision
   1.226 -  number.
   1.227 -\item[\tplkword{tags}] List of strings.  Any tags associated with the
   1.228 -  changeset.
   1.229 -\end{itemize}
   1.230 -
   1.231 -A few simple experiments will show us what to expect when we use these
   1.232 -keywords; you can see the results in
   1.233 -figure~\ref{fig:template:keywords}.
   1.234 +\item[\tplkword{date}] Información de fecha.  La fecha en la cual se
   1.235 +  consignó el conjunto de cambios.  \emph{No} es legible por un
   1.236 +  humano, debe pasarla por un firltro que la desplegará
   1.237 +  apropiadamente.  En la sección~\ref{sec:template:filter} hay más
   1.238 +  detalles acerca de filtros.  La fecha se expresa como un par de
   1.239 +  números.  El primer número corresponde a una marca de tiempo UNIX
   1.240 +  UTC(segundos desde el primero de enero de 1970); la segunda es el
   1.241 +  corrimiento horario de la zona horaria del UTC en la cual se encontraba
   1.242 +  quien hizo la consignación, en segundos.
   1.243 +\item[\tplkword{desc}] Cadena.  La descripción en texto del conjunto
   1.244 +  de cambios.
   1.245 +\item[\tplkword{files}] Lista de cadenas.  Todos los ficheros
   1.246 +  modificados, adicionados o eliminados por este conjunto de cambios.
   1.247 +\item[\tplkword{file\_adds}] Lista de cadenas.  Ficheros adicionados
   1.248 +  por este conjunto de cambios.
   1.249 +\item[\tplkword{file\_dels}] Lista de cadenas.  Ficheros eliminados
   1.250 +  por este conjunto de cambios.
   1.251 +\item[\tplkword{node}] Cadena.  El hash de identificación de este
   1.252 +  conjunto de cambios como una cadena hexadecimal de 40 caracteres.
   1.253 +\item[\tplkword{parents}] Lista de cadenas.  Los ancestros del
   1.254 +  conjunto de cambios.
   1.255 +\item[\tplkword{rev}] Entero.  El número de revisión del repositorio
   1.256 +  local.
   1.257 +\item[\tplkword{tags}] Lista de cadenas.  Todas las etiquetas
   1.258 +  asociadas al conjunto de cambios.
   1.259 +\end{itemize}
   1.260 +
   1.261 +Unos experimentos sencillos nos mostrarán qué esperar cuando usamos
   1.262 +estas palabras claves; puede ver los resultados en la
   1.263 +figura~\ref{fig:template:keywords}.
   1.264  
   1.265  \begin{figure}
   1.266    \interaction{template.simple.keywords}
   1.267 @@ -146,61 +155,63 @@
   1.268    \label{fig:template:keywords}
   1.269  \end{figure}
   1.270  
   1.271 -As we noted above, the date keyword does not produce human-readable
   1.272 -output, so we must treat it specially.  This involves using a
   1.273 -\emph{filter}, about which more in section~\ref{sec:template:filter}.
   1.274 +Como mencionamos anteriormente, la palabra clave de fecha no produce
   1.275 +salida legible por un humano, debemos tratarla de forma especial.
   1.276 +Esto involucra usar un \emph{filtro}, acerca de lo cual hay más en la
   1.277 +sección~\ref{sec:template:filter}.
   1.278  
   1.279  \interaction{template.simple.datekeyword}
   1.280  
   1.281 -\section{Escape sequences}
   1.282 +\section{Secuencias de Control}
   1.283  \label{sec:template:escape}
   1.284  
   1.285 -Mercurial's templating engine recognises the most commonly used escape
   1.286 -sequences in strings.  When it sees a backslash (``\Verb+\+'')
   1.287 -character, it looks at the following character and substitutes the two
   1.288 -characters with a single replacement, as described below.
   1.289 +El motor de plantillas de Mercurial reconoce las secuencias de control
   1.290 +más comunmente usadas dentro de las cadenas.  Cuando ve un backslash
   1.291 +(``\Verb+\+''), ve el caracter siguiente y sustituye los dos
   1.292 +caracteres con un reemplazo sencillo, como se describe a continuación:
   1.293  
   1.294  \begin{itemize}
   1.295  \item[\Verb+\textbackslash\textbackslash+] Backslash, ``\Verb+\+'',
   1.296    ASCII~134.
   1.297 -\item[\Verb+\textbackslash n+] Newline, ASCII~12.
   1.298 -\item[\Verb+\textbackslash r+] Carriage return, ASCII~15.
   1.299 +\item[\Verb+\textbackslash n+] Nueva línea, ASCII~12.
   1.300 +\item[\Verb+\textbackslash r+] Cambio de línea, ASCII~15.
   1.301  \item[\Verb+\textbackslash t+] Tab, ASCII~11.
   1.302 -\item[\Verb+\textbackslash v+] Vertical tab, ASCII~13.
   1.303 -\item[\Verb+\textbackslash \{+] Open curly brace, ``\Verb+{+'', ASCII~173.
   1.304 -\item[\Verb+\textbackslash \}+] Close curly brace, ``\Verb+}+'', ASCII~175.
   1.305 -\end{itemize}
   1.306 -
   1.307 -As indicated above, if you want the expansion of a template to contain
   1.308 -a literal ``\Verb+\+'', ``\Verb+{+'', or ``\Verb+{+'' character, you
   1.309 -must escape it.
   1.310 -
   1.311 -\section{Filtering keywords to change their results}
   1.312 +\item[\Verb+\textbackslash v+] Tab Vertical, ASCII~13.
   1.313 +\item[\Verb+\textbackslash \{+] Corchete abierto, ``\Verb+{+'', ASCII~173.
   1.314 +\item[\Verb+\textbackslash \}+] Corchete cerrado, ``\Verb+}+'', ASCII~175.
   1.315 +\end{itemize}
   1.316 +
   1.317 +Como se indicó arriba, si desea que la expansión en una plantilla
   1.318 +contenga un caracter literal ``\Verb+\+'', ``\Verb+{+'', o
   1.319 +  ``\Verb+{+'', debe escaparlo.
   1.320 +
   1.321 +\section{Uso de filtros con palabras claves}
   1.322  \label{sec:template:filter}
   1.323  
   1.324 -Some of the results of template expansion are not immediately easy to
   1.325 -use.  Mercurial lets you specify an optional chain of \emph{filters}
   1.326 -to modify the result of expanding a keyword.  You have already seen a
   1.327 -common filter, \tplkwfilt{date}{isodate}, in action above, to make a
   1.328 -date readable.
   1.329 -
   1.330 -Below is a list of the most commonly used filters that Mercurial
   1.331 -supports.  While some filters can be applied to any text, others can
   1.332 -only be used in specific circumstances.  The name of each filter is
   1.333 -followed first by an indication of where it can be used, then a
   1.334 -description of its effect.
   1.335 -
   1.336 -\begin{itemize}
   1.337 -\item[\tplfilter{addbreaks}] Any text. Add an XHTML ``\Verb+<br/>+''
   1.338 -  tag before the end of every line except the last.  For example,
   1.339 -  ``\Verb+foo\nbar+'' becomes ``\Verb+foo<br/>\nbar+''.
   1.340 -\item[\tplkwfilt{date}{age}] \tplkword{date} keyword.  Render the
   1.341 -  age of the date, relative to the current time.  Yields a string like
   1.342 +Algunos de los resultados de la expansión de la plantilla no son
   1.343 +fáciles de usar de inmediato.  Mercurial le permite especificar una
   1.344 +cadena de \emph{filtros} opcionales para modificar el resultado de
   1.345 +expandir una palabra clave.  Ya ha visto el filtro usual
   1.346 +\tplkwfilt{date}{isodate} en acción con anterioridad para hacer
   1.347 +legible la fecha.
   1.348 +
   1.349 +A continuación hay una lista de los filtros de Mercurial más
   1.350 +comunmente usados.  Ciertos filtros pueden aplicarse a cualquier
   1.351 +texto, otros pueden usarse únicamente en circunstancias específicas.
   1.352 +El nombre de cada filtro está seguido de la indicación de dónde puede
   1.353 +ser usado y una descripción de su efecto.
   1.354 +
   1.355 +\begin{itemize}
   1.356 +\item[\tplfilter{addbreaks}] Cualquier texto. Añade una etiqueta XHTML
   1.357 +  ``\Verb+<br/>+'' antes del final de cada línea excepto en la final.
   1.358 +  Por ejemplo, ``\Verb+foo\nbar+'' se convierte en ``\Verb+foo<br/>\nbar+''.
   1.359 +\item[\tplkwfilt{date}{age}] palabra clave \tplkword{date}.  Muestra
   1.360 +  la edad de la fecha, relativa al tiempo actual. Ofrece una cadena como
   1.361    ``\Verb+10 minutes+''.
   1.362 -\item[\tplfilter{basename}] Any text, but most useful for the
   1.363 -  \tplkword{files} keyword and its relatives.  Treat the text as a
   1.364 -  path, and return the basename. For example, ``\Verb+foo/bar/baz+''
   1.365 -  becomes ``\Verb+baz+''.
   1.366 +\item[\tplfilter{basename}] Cualquier texto, pero de utilidad sobre
   1.367 +  todo en palabras claves relativas a \tplkword{ficheros}.  Trata el
   1.368 +  texto como una ruta, retornando el nombre base.  Por ejemplo,
   1.369 +  ``\Verb+foo/bar/baz+'', se convierte en ``\Verb+baz+''.
   1.370  \item[\tplkwfilt{date}{date}] \tplkword{date} keyword.  Render a date
   1.371    in a similar format to the Unix \tplkword{date} command, but with
   1.372    timezone included.  Yields a string like