| Author | Dave Jarvis <email> |
|---|---|
| Date | 2013-02-25 08:32:39 GMT-0800 |
| Commit | eeca0bf18674fbf97d3b79147910768bf363c043 |
| Parent | fed55d6 |
| -\renewcommand{\headingmarker}{\tikz[baseline=-3pt]\node[diamond,draw=none,inner sep=2.25pt,fill=\headingcolor]{};} | ||
| +%\renewcommand{\headingmarker}{\tikz[baseline=-3pt]\node[diamond,draw=none,inner sep=2.25pt,fill=\headingcolor]{};} | ||
| +\makeatletter | ||
| +\renewcommand{\headingmarker}{\setlength{\tmplength}{\f@size pt}\tikz[baseline=-.26\tmplength]\node[diamond,draw=none,inner sep=.19\tmplength,fill=\headingcolor]{};} | ||
| +\makeatother | ||
| \renewcommand{\itemmarker}{\textcolor{\secondarycolor}{\scriptsize$\blacksquare$}} | ||
| \renewcommand{\inlinelistmarker}{\makebox[1.5em][c]{\color{\secondarycolor}\tiny$\blacksquare$}} |
| This book is available under a \href{http://creativecommons.org/licenses/by-sa/3.0/}{Creative Commons Attribution-ShareAlike License}.\\ | ||
| Generated using \href{http://recipezeal.com}{Recipe Zeal} and \LaTeX.\\ | ||
| -Theme designs by \href{http://liantze.penguinattack.org}{Lian Tze Lim}. | ||
| +Book design and themes by \href{http://liantze.penguinattack.org}{Lian Tze Lim}. | ||
| %\end{titlingpage}% | ||
| } | ||
| %%%% Basic structures, redefine as needed in theme files using titlesec and enumitem. | ||
| +\newcommand{\recipecategory}[1]{% | ||
| +\clearforchapter | ||
| +\formatcategorypage{#1} | ||
| +\phantomsection\addcontentsline{toc}{chapter}{#1} | ||
| +\clearpage | ||
| +} | ||
| + | ||
| +\newcommand{\formatcategorypage}[1]{% | ||
| +\thispagestyle{empty} | ||
| +\vspace*{\stretch{1}} | ||
| +\begin{center} | ||
| +\fontsize{48pt}{50pt}\headingfamily\bfseries\selectfont\color{\recipecolor}#1 | ||
| +\end{center} | ||
| +\vspace*{\stretch{2}} | ||
| +} | ||
| + | ||
| \newenvironment{recipe}[1]{% | ||
| \clearpage% | ||
| \color{\maintextcolor}% | ||
| \section{#1} | ||
| }{} | ||
| \newcommand{\fullpagephoto}[1]{% | ||
| +\ThisTileWallPaper{.7in}{.6in}{photo/echeveria} | ||
| \ThisCenterWallPaper{1}{#1} | ||
| +\mbox{}\clearpage | ||
| } | ||
| \newcommand{\insetphoto}[1]{% | ||
| \includegraphics[width=.4\textwidth]{#1}\par | ||
| +} | ||
| + | ||
| +\newcommand{\checkfiller}{% | ||
| + \clearpage | ||
| + \checkoddpage\strictpagecheck\ifoddpage\ThisCenterWallPaper{1}{photo/filler1}\mbox{}\clearpage\fi | ||
| } | ||
| %\newcommand{\lettergroup}[1]{\item{\item\textbf{#1}}} | ||
| %\let\lettergroupDefault\lettergroup | ||
| -\newcommand\sssubitem{\@idxitem \hspace*{40\p@}} | ||
| -\newcommand\sssssubitem{\@idxitem \hspace*{50\p@}} | ||
| -\newcommand\sssssssubitem{\@idxitem \hspace*{60\p@}} | ||
| +\renewcommand\subitem{\@idxitem } | ||
| +\renewcommand\subsubitem{\@idxitem \hspace*{10\p@}} | ||
| +\newcommand\sssubitem{\@idxitem \hspace*{20\p@}} | ||
| +\newcommand\sssssubitem{\@idxitem \hspace*{30\p@}} | ||
| +\newcommand\sssssssubitem{\@idxitem \hspace*{40\p@}} | ||
| %% placeholders | ||
| \providecommand{\vhrulefill}[1]{\leavevmode\leaders\hrule\@height#1\hfill \kern\z@} | ||
| \makeatother | ||
| -%\providecommand{\fullruled}[2][1pt]{#2\vskip-3pt\rule{\linewidth}{#1}} | ||
| \providecommand{\fullruled}[2][1pt]{#2\vskip-4pt\vhrulefill{#1}} | ||
| \providecommand{\halfruled}[2][.4pt]{\headingmarker\ #2\vskip-6pt\rule{.5\linewidth}{#1}\vskip-4pt} | ||
| \end{tikzpicture} | ||
| \vspace*{.5in}\par | ||
| -\textcolor{\recipecolor}{\sffamily\fontsize{56pt}{58pt}\selectfont\fullruled[2pt]{\thetitle}}\par | ||
| +\textcolor{\recipecolor}{\sffamily\fontsize{56pt}{58pt}\selectfont\raggedright\fullruled[2pt]{\thetitle}}\par | ||
| \vfill | ||
| {\huge\itshape\color{\darkhighlight}A recipe compilation by \theauthor\par} | ||
| \patchcommand{\printchaptertitle}{\color{\recipecolor}}{} | ||
| \setlength\beforechapskip{-\baselineskip} | ||
| + | ||
| +\renewcommand{\formatcategorypage}[1]{% | ||
| +\thispagestyle{empty} | ||
| +\begin{tikzpicture}[overlay,remember picture] | ||
| +\fill[\primarycolor,opacity=.5] ([xshift=-.6in]current page.north east) rectangle (current page.south east); | ||
| +\draw[\primarycolor,opacity=.5,line width=6pt] ([xshift=-.8in]current page.north east) -- ([xshift=-.8in]current page.south east); | ||
| +\end{tikzpicture} | ||
| +\vfill | ||
| +{\raggedleft% | ||
| +\tikz[overlay]\node[font=\fontsize{160pt}{162pt}\itshape\selectfont,opacity=.2,text=\primarycolor,yshift=20pt]{\substring{#1}{1}{1}}; | ||
| +\fontsize{48pt}{50pt}\headingfamily\bfseries\itshape\selectfont\color{\recipecolor}#1\hspace*{.3in}\par} | ||
| +\vskip6pt | ||
| +\tikz[overlay,remember picture]\draw[line width=6pt,\primarycolor] (0,0 -| current page.east) -- (0,0 -| current page.west); | ||
| +} | ||
| \renewcommand{\ovenstyle}{\itshape\par} | ||
| leftmargin=*,% | ||
| itemsep=1pt,% | ||
| - label={\enumeratemarker{\arabic*}} | ||
| + label={\enumeratemarker{\arabic*}},% | ||
| + after*={\vspace{-\topsep}} | ||
| } | ||
| --> | ||
| -<!-- --> | ||
| -<xsl:key name="preg" match="/recipe-book/ingredients/ingredient" use="@id" /> | ||
| +<!-- Keys --> | ||
| +<xsl:key name="ingredient-id" match="/recipe-book/ingredients/ingredient" use="@id" /> | ||
| +<xsl:key name="recipe-by-category" match="recipe" use="tags/tag[1]" /> | ||
| <xsl:template match="/recipe-book"> | ||
| </xsl:if> | ||
| <xsl:text>\mainmatter
</xsl:text> | ||
| + | ||
| + <!-- | ||
| <xsl:apply-templates select="*[name()!='book']" /> | ||
| + --> | ||
| + <!-- | ||
| + | "Muenchian Method" as described in | ||
| + | XSLT Cookbook, by Sal Mangano, O'Reilly, pg195 | ||
| + +--> | ||
| + <xsl:for-each select="recipe[count(. | key('recipe-by-category',tags/tag[1])[1]) = 1]"> | ||
| + <xsl:variable name="current-grouping-key" select="tags/tag[1]"/> | ||
| + <xsl:text>
\recipecategory{</xsl:text> | ||
| + <xsl:apply-templates select="$current-grouping-key" mode="escape-capitalize"/> | ||
| + <xsl:text>}

</xsl:text> | ||
| + <xsl:variable name="current-group" | ||
| + select="key('recipe-by-category', | ||
| + $current-grouping-key)" /> | ||
| + <xsl:for-each select="$current-group"> | ||
| + <xsl:apply-templates select="." /> | ||
| + </xsl:for-each> | ||
| +</xsl:for-each> | ||
| + | ||
| <xsl:text>\backmatter
</xsl:text> | ||
| <xsl:text>\renewcommand{\clearforchapter}{\newpage}
</xsl:text> | ||
| +--> | ||
| <xsl:template match="recipe"> | ||
| + <!-- | ||
| + | If a facing full-page photo is used, check whether | ||
| + | a filler photo (advert) is required to make up | ||
| + | the page number. | ||
| + +--> | ||
| + <xsl:if test="description/photo[@use='recipe-page']"> | ||
| + <xsl:text>\checkfiller
</xsl:text> | ||
| + </xsl:if> | ||
| <xsl:text>\begin{recipe}{</xsl:text> | ||
| <xsl:apply-templates select="description/title" /> | ||
| <xsl:text>}
</xsl:text> | ||
| - <xsl:apply-templates select="description/photo" mode="recipe" /> | ||
| + <xsl:apply-templates select="description/photo[@use='recipe-inset']" mode="recipe" /> | ||
| <xsl:apply-templates /> | ||
| + <xsl:apply-templates select="description/photo[@use='recipe-page']" mode="recipe" /> | ||
| <xsl:text>\end{recipe}

</xsl:text> | ||
| </xsl:template> | ||
| + | ||
| <xsl:template match="photo[@use='front-cover']" mode="book"> | ||
| <xsl:apply-templates select="uri" mode="book" /> | ||
| </xsl:template> | ||
| <xsl:template match="photo[@use='recipe-inset']" mode="recipe"> | ||
| <xsl:apply-templates select="uri" mode="recipe-inset" /> | ||
| +</xsl:template> | ||
| + | ||
| +<xsl:template match="photo[@use='recipe-page']" mode="recipe"> | ||
| + <xsl:apply-templates select="uri" mode="recipe-page" /> | ||
| </xsl:template> | ||
| <xsl:apply-templates /> | ||
| <xsl:text>}
</xsl:text> | ||
| +</xsl:template> | ||
| + | ||
| +<xsl:template match="uri" mode="recipe-page"> | ||
| + <xsl:text>\afterpage{\fullpagephoto{</xsl:text> | ||
| + <xsl:apply-templates /> | ||
| + <xsl:text>}}
</xsl:text> | ||
| </xsl:template> | ||
| + | ||
| <xsl:template match="description/title"> | ||
| <xsl:value-of select="@unit" /> | ||
| <xsl:text>}{</xsl:text> | ||
| - <xsl:apply-templates select="key('preg', @id)/@name" /> | ||
| + <xsl:apply-templates select="key('ingredient-id', @id)/@name" /> | ||
| <xsl:text>}%
</xsl:text> | ||
| <!-- Put the ingredients in a categorized list. --> | ||
| - <xsl:if test="key('preg',@id)/categories/category"> | ||
| - <xsl:for-each select="key('preg',@id)/categories/category"> | ||
| + <xsl:if test="key('ingredient-id',@id)/categories/category"> | ||
| + <xsl:for-each select="key('ingredient-id',@id)/categories/category"> | ||
| <xsl:text> \index[catingred]{</xsl:text> | ||
| <xsl:call-template name="split"> | ||
| <!-- Put the ingredients in a flat list. --> | ||
| <xsl:text> \index[flatingred]{</xsl:text> | ||
| - <xsl:apply-templates select="key('preg', @id)/@name" /> | ||
| + <xsl:apply-templates select="key('ingredient-id', @id)/@name" /> | ||
| <xsl:text>}%
</xsl:text> | ||
| </xsl:template> | ||
| <xsl:apply-templates select="@condition" mode="prep" /> | ||
| <xsl:text> the </xsl:text> | ||
| - <xsl:apply-templates select="key('preg', @id)/@name" /> | ||
| + <xsl:apply-templates select="key('ingredient-id', @id)/@name" /> | ||
| <xsl:text>.
</xsl:text> | ||
| </xsl:for-each> | ||
| Delta | 100 lines added, 16 lines removed, 84-line increase |
|---|