Improved and simplified title block in context template.

Previously it caused an error if there was no title.
This method should also be easier for users to customize.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1867 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2010-03-07 19:35:33 +00:00
parent 9eebaac7cf
commit c5e718ce9e

View file

@ -17,24 +17,6 @@ $else$
\setuphead[subsection][style=\tfb]
\setuphead[subsubsection][style=\bf]
% define title block commands
\unprotect
\def\doctitle#1{\gdef\@title{#1}}
\def\author#1{\gdef\@author{#1}}
\def\date#1{\gdef\@date{#1}}
\date{\currentdate} % Default to today unless specified otherwise.
\def\maketitle{%
\startalignment[center]
\blank[2*big]
{\tfd \@title}
\blank[3*medium]
{\tfa \@author}
\blank[2*medium]
{\tfa \@date}
\blank[3*medium]
\stopalignment}
\protect
% define descr (for definition lists)
\definedescription[descr][
headstyle=bold,style=normal,align=left,location=hanging,
@ -75,15 +57,22 @@ $for(header-includes)$
$header-includes$
$endfor$
$if(title)$
\doctitle{$title$}
$endif$
\author{$for(author)$$author$$sep$\\$endfor$}
$if(date)$
\date{$date$}
$endif$
\starttext
\maketitle
$if(title)$
\startalignment[center]
\blank[2*big]
{\tfd $title$}
$if(author)$
\blank[3*medium]
{\tfa $for(author)$$author$$sep$\crlf $endfor$}
$endif$
$if(date)$
\blank[2*medium]
{\tfa $date$}
$endif$
\blank[3*medium]
\stopalignment
$endif$
$if(toc)$
\placecontent
$endif$