Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/recipe-books.git

Implemented citation fields as pgfkeys.

Author liantze <email>
Date 2013-03-09 16:42:20 GMT+0800
Commit 0456b83a1c448d0507eef1c922077746eb86cc90
Parent 3a9c683
layout/topbottom.tex
-\renewenvironment{recipe}[1]{%
+\renewcommand{\inlinecitationalignment}{\centering}
+\renewenvironment{recipe}[2][]{%
\clearpage%
- \section{#1}
+ \parserecipecitation{#1}
+ \section{#2}
+ \checkinlinecitation
\color{\maintextcolor}%
\raggedcolumns
\begin{multicols}{2}
}{%
\clearpage%
}
\renewcommand{\startinstructions}{\end{multicols}}
-\renewcommand{\photo}[1]{%
- \insetphoto{#1}\columnbreak
-}
+%\renewcommand{\photo}[1]{%
+% \insetphoto{#1}\columnbreak
+%}
\compactequipment
layout/twocolumn-twoside.tex
-\renewenvironment{recipe}[1]{%
+\renewcommand{\inlinecitationalignment}{%
+ \iftoggle{print}{%
+ \checkoddpage\strictpagecheck\ifoddpage\raggedright\else\raggedleft\fi
+ }{%
+ \raggedleft
+ }
+}
+
+\renewenvironment{recipe}[2][]{%
\clearpage%
+ \parserecipecitation{#1}
\color{\maintextcolor}%
\raggedcolumns
\iftoggle{print}{%
\checkoddpage\strictpagecheck\ifoddpage\RLmulticolcolumns\else\LRmulticolcolumns\fi
}{%
\LRmulticolcolumns
}
- \begin{multicols*}{2}[\section{#1}]%
+ \begin{multicols*}{2}[\section{#2}\checkinlinecitation]%
}{%
\end{multicols*}%
}
\renewcommand{\startinstructions}{\columnbreak}
-\renewcommand{\photo}[1]{\insetphoto{#1}}
+%\renewcommand{\photo}[1]{\insetphoto{#1}}
\normalingredients
recipe-book.cls
\RequirePackage{microtype}
\RequirePackage{bookmark}
-
-% From http://tex.stackexchange.com/a/9266/226
-% to fix potential problems with opacity, colourspace
-% in PDF
-\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
-
-%% placeholders
-\newcommand{\recipetitle}{}
-\providelength{\tmplength}
-\providelength{\afterinsetphotoskip}
-\setlength{\afterinsetphotoskip}{1em}
-\def\@frontcoverphoto{}
-\newcommand{\frontcoverphoto}[1]{%
- \def\@frontcoverphoto{#1}
-}
-\def\@citationref{}
-\def\@recipecredittext{}
-\def\@recipelicensetext{}
-\def\@photocredittext{}
-\def\@photolicensetext{}
-\def\citationtext{}
-\newcommand{\recipecredit}[2][]{%
- \gdef\@recipecredittext{%
- \ifblank{#1}{#2}{\href{#1}{#2}}}
-}
-\newcommand{\recipelicense}[2][]{%
- \gdef\@recipelicensetext{, %
- \ifblank{#1}{#2}{\href{#1}{#2}}}
-}
-\newcommand{\photocredit}[2][]{%
- \gdef\@photocredittext{%
- \ifblank{#1}{#2}{\href{#1}{#2}}}
-}
-\newcommand{\photolicense}[2][]{%
- \gdef\@photolicensetext{, %
- \ifblank{#1}{#2}{\href{#1}{#2}}}
-}
-
-\iftoggle{endcitations}{\makepagenote}{}
-\def\blfootnote{\xdef\@thefnmark{}\@footnotetext}
-\renewcommand{\notesname}{Recipe and Photo Sources}
-\newcommand{\xpagenote}[1]{%
- \unskip\begingroup\protected@edef\x{\endgroup\noexpand\pagenote{#1}}%
- \scantokens\expandafter{\x\relax}}
-\renewcommand*{\notenumintext}[1]{}
-\renewcommand*{\notenuminnotes}[1]{}
-\setPagenoteSpacing{2}
-\renewcommand{\prenoteinnotes}{\item }
-\renewcommand{\postnoteinnotes}{}
-
-% For Inserts.
-% \DeclareInserts{25}{ad1.jpg, ad2.jpg, ad3.jpg, ad4.jpg}
-% \InsertAd will cycle through ad1.jpg -> ad4.jpg everytime
-% it is called.
-% It'll be called after every 25 recipes.
-\newarray\Inserts
-\newcounter{advertTotal}
-\newcounter{advertIdx}
-\newcounter{recipeIdx}
-\newcommand{\advertTotal}{\theadvertTotal}
-\newcommand{\DeclareInserts}[2]{%
- \def\recipeAdCount{#1}
- \renewcommand*{\do}[1]{%
- \stepcounter{advertTotal}%
- \Inserts(\arabic{advertTotal})={##1}
- }
- \docsvlist{#2}
-}
-\newcommand{\InsertAd}{%
- \ifnumequal{\theadvertTotal}{0}{}{%
- \thispagestyle{empty}
- \stepcounter{advertIdx}%
- \pgfmathparse{mod(\theadvertIdx - 1,\advertTotal) + 1}
- \pgfmathtruncatemacro{\adIdx}{\pgfmathresult}%
- \checkInserts(\adIdx)
- \ThisTileWallPaper{\paperwidth}{\paperheight}{\cachedata}
- \mbox{}\clearpage
- }
-}
-
-
-%%% Hook for cover page etc
-% TODO: change this to use key options
-\newcommand{\makecover}[1][]{%
-\begin{titlingpage}
-\ifdefempty{\@frontcoverphoto}{%
- \maketitle
-}{%
- \ThisTileWallPaper{\paperwidth}{\paperheight}{\@frontcoverphoto}
- \mbox{}\clearpage
-}
-\thispagestyle{empty}
-\ifstrequal{#1}{copyrightpage}{\clearpage\makecrpage}{}
-\end{titlingpage}%
-}
-
-\newcommand{\makecrpage}{%
-%\begin{titlingpage}
-\mbox{}
-\vfill
-\small
-Recipe compilation by \theauthor.
-\ifdefempty{\@frontcoverphoto}{}{%
- \ifdefempty{\@photocredittext}{}{%
- Front cover photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.
- }
-}
-\\
-\\
-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.\\
-Book design and themes by \href{http://liantze.penguinattack.org}{Lian Tze Lim}.
-%\end{titlingpage}%
-}
-
-\patchcommand{\mainmatter}{}{%
-%%% turn off sectional numberings
-\setcounter{secnumdepth}{-1}
-\setcounter{tocdepth}{1}
-%% set end notes to be an itemised list
-\addtonotes{\protect\begin{itemize}[label=\itemmarker,nosep,leftmargin=*]}
-}
-
-%%% Overview as a bit of a chapter introduction
-\newenvironment{overview}[1]{%
-\chapter*{#1}
-\providelength{\oldparskip}
-\setlength{\oldparskip}{\parskip}
-\setlength{\parskip}{\onelineskip}
-}{%
-\setlength{\parskip}{\oldparskip}
-\clearpage
-}
-
-%%%% TODO cooking time, preparation time, portion... "atomic" fields
-\newcommand{\ovenstyle}{}
-\newcommand{\oven}[1]{\makebox{\ovenstyle Preheat oven to #1}\par}
-
-\newcommand{\maintextcolor}{black}
-\newcommand{\primarycolor}{blue}
-\newcommand{\secondarycolor}{blue!80}
-\newcommand{\tertiarycolor}{blue!60}
-\newcommand{\primarycolorcomplement}{white}
-\newcommand{\secondarycolorcomplement}{white}
-\newcommand{\tertiarycolorcomplement}{white}
-\newcommand{\darkhighlight}{red!80!black}
-\newcommand{\brighthighlight}{red}
-\newcommand{\highlightcolor}{\darkhighlight}
-\newcommand{\externallinkcolor}{SteelBlue}
-
-\newcommand{\scriptdefault}{pzc}
-\newcommand{\scriptfamily}{\fontfamily{\scriptdefault}\selectfont}
-
-\newcommand{\recipecolor}{\highlightcolor}
-\newcommand{\recipefamily}{\sffamily}
-\newcommand{\recipesize}{\LARGE}
-\newcommand{\recipestyle}{\bfseries}
-\newcommand{\recipefont}{\recipefamily\recipesize\color{\recipecolor}\recipestyle}
-
-\newcommand{\headingcolor}{\primarycolor}
-\newcommand{\headingfamily}{\sffamily}
-\newcommand{\headingsize}{\large}
-\newcommand{\headingstyle}{\itshape}
-\newcommand{\headingfont}{\headingfamily\headingsize\color{\headingcolor}\headingstyle}
-
-\renewcommand{\chaptitlefont}{\recipefamily\color{\recipecolor}\bfseries\HUGE\centering}
-\setsecheadstyle{\recipefont}
-\setsubsecheadstyle{\headingfont}
-
-\newcommand{\headingmarker}{\textbullet}
-\newcommand{\itemmarker}{\textbullet}
-\newcommand{\enumeratemarker}[1]{#1.}
-\newcommand{\inlinelistmarker}{\makebox[1.5em][c]{\textbullet}}
-
-\newcommand{\equipmentstyle}{leftmargin=*}
-\newcommand{\ingredientsstyle}{label=\textbullet,leftmargin=*}
-\newcommand{\preparationstyle}{label=\textbullet,leftmargin=*}
-\newcommand{\substitutionstyle}{label=\textbullet,leftmargin=*}
-\newcommand{\instructionsstyle}{label={\arabic*. },leftmargin=*}
-
-
-%%%% 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}
-}{}
-
-\renewcommand{\memsecinfo}[5]{%
- \ifstrequal{#1}{section}{\renewcommand{\recipetitle}{#3}}{}
-}
-
-\AtBeginEnvironment{recipe}{%
- \gdef\@recipecredittext{}
- \gdef\@recipelicensetext{}
- \gdef\@photocredittext{}
- \gdef\@photolicensetext{}
- \gdef\citationtext{}
-}
-
-\AtEndEnvironment{recipe}{%
- \ifdefempty{\@recipecredittext}{}{\apptocmd{\citationtext}{By \@recipecredittext\ifdefempty{\@recipelicensetext}{}{\@recipelicensetext}.}{}{}}
- \ifdefempty{\@photocredittext}{}{\apptocmd{\citationtext}{ Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.}{}{}}
- \iftoggle{footercitations}{%
- \ifdefempty{\citationtext}{}{\blfootnote{\citationtext}}
- }{}
- \iftoggle{endcitations}{%
- \ifdefempty{\citationtext}{}{\leavevmode\xpagenote{\textcolor{\darkhighlight}{\sffamily\bfseries\recipetitle}\space\textit{(p.\thepage)}\enspace\citationtext}}
- }{}
-}
-
-\AfterEndEnvironment{recipe}{%
- % Check if an ad should be inserted
- \ifdef{\recipeAdCount}{
- \ifnumgreater{\theadvertTotal}{0}{
- \stepcounter{recipeIdx}
- \pgfmathparse{mod(\therecipeIdx,\recipeAdCount)}
- \pgfmathtruncatemacro{\recIdx}{\pgfmathresult}
- \ifnumequal{\recIdx}{0}{\afterpage{\InsertAd}}{}
- }{}
- }{}
-}
-
-\newcommand{\insetphoto}[2][.4\textwidth]{%
- \includegraphics[width=#1]{#2}\par
-}
-
-\newcommand{\fullpagephoto}[1]{%
- \afterpage{%
- \ThisTileWallPaper{\paperwidth}{\paperheight}{#1}
- \iftoggle{clearpn}{\thispagestyle{empty}}{}
- \iftoggle{inlinecitations}{%
- \ifdefempty{\@photocredittext}{}{%
- \begin{tikzpicture}[overlay,remember picture]
- \node[fill=white,fill opacity=.8,text opacity=1,font=\small\sffamily\itshape,
- anchor=north east,xshift=-.5in,yshift=-.5in]
- at (current page.north east)
- {Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
- \end{tikzpicture}
- }
- }{}
- \mbox{}\clearpage}
-}
-
-\newcommand{\checkfiller}{%
- \iftoggle{print}{%
- \clearpage
- \checkoddpage\strictpagecheck
-% \ifoddpage\ThisTileWallPaper{\paperwidth}{\paperheight}{photo/filler1}\mbox{}\clearpage\fi
- \ifoddpage\InsertAd\fi
- }{}
-}
-
-\newcommand{\photo}[1]{\insetphoto{#1}}
-
-\newcommand{\SpreadWallPaperLeft}[1]{%
- \sbox0{\includegraphics{#1}}%
- \AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
- \parbox[b][\paperheight]{\paperwidth}{%
- \vfill
- \centering
- \includegraphics[width=\paperwidth,height=\paperheight,clip,trim=0 0 {.5\wd0} 0]{#1}%
- \vfill
- }}}
-% \iftoggle{clearpn}{\thispagestyle{empty}}{}
-}
-
-\newcommand{\SpreadWallPaperRight}[1]{%
- \sbox0{\includegraphics{#1}}%
- \AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
- \parbox[b][\paperheight]{\paperwidth}{%
- \vfill
- \centering
- \includegraphics[width=\paperwidth,height=\paperheight,clip,trim={.5\wd0} 0 0 0]{#1}%
- \vfill
- }}}
- \iftoggle{clearpn}{\thispagestyle{empty}}{}
- \iftoggle{inlinecitations}{%
- \ifdefempty{\@photocredittext}{no}{%
- \begin{tikzpicture}[overlay,remember picture]
- \node[fill=white,fill opacity=.8,text opacity=1,font=\small\sffamily\itshape,
- anchor=north east,xshift=-.5in,yshift=-.5in]
- at (current page.north east)
- {Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
- \end{tikzpicture}
- }
- }{}
-
-}
-
-\newcommand{\landscapedphoto}[1]{%
- \AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
- \parbox[b][\paperheight]{\paperwidth}{%
- \vfill
- \centering
- \includegraphics[width=\paperheight,height=\paperwidth,angle=90]{#1}%
- \vfill
- }}}
- \iftoggle{inlinecitations}{%
- \ifdefempty{\@photocredittext}{}{%
- \begin{tikzpicture}%[overlay,remember picture]
- \node[fill=white,fill opacity=.8,text opacity=1,font=\small\sffamily\itshape,
- %anchor=north west,%xshift=.5in,yshift=-.5in
- ]
- %at (current page.north)
- {Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
- \end{tikzpicture}
- }
- }{}
-}
-
-\newcommand{\twopagespreadphoto}[1]{%
- \iftoggle{print}{%
- \SpreadWallPaperLeft{#1}
- \mbox{}\clearpage
- \afterpage{\SpreadWallPaperRight{#1}
- \mbox{}\clearpage}
- }{\afterpage{%
- \begin{landscape}
- \thispagestyle{empty}
- \landscapedphoto{#1}\mbox{}\clearpage
- \end{landscape}
- }}
-}
-
-\AtBeginDocument{%
- \iftoggle{inlinecitations}{%
- % See http://tex.stackexchange.com/a/68741/226
- \expandafter\apptocmd\csname\string\insetphoto\endcsname{%
- \ifdefempty{\@photocredittext}{}{\vskip-\afterinsetphotoskip
- {\centering\small\sffamily\itshape Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.\par}
- \vskip\afterinsetphotoskip
- }%
- }{}{}
- }{}
-}
-
-\newenvironment{equipment}[1][Equipment]{%
- \needspace{3\baselineskip}
- \subsection{#1}
- \expandafter\setlist\expandafter{\equipmentstyle}%
- \begin{equipmentlist}
-}{%
- \end{equipmentlist}
-}
-
-\newenvironment{equipmentlist}{%
- \begin{description}
-}{%
- \end{description}
-}
-
-\newcommand{\compactequipment}{%
- \renewenvironment{equipmentlist}{%
- \begin{description*}[mode=unboxed,leftmargin=*,itemjoin=\inlinelistmarker]
- }{%
- \end{description*}.
- }
-}
-
-\newcommand{\normalequipment}{%
- \renewenvironment{equipmentlist}{%
- \begin{description}
- }{%
- \end{description}
- }
-}
-
-\newenvironment{preparation}[1][Preparation]{%
- \needspace{3\baselineskip}
- \subsection{#1}
- \expandafter\setlist\expandafter{\preparationstyle}%
- \begin{preparationlist}
-}{%
- \end{preparationlist}
-}
-
-\newenvironment{preparationlist}{%
- \begin{itemize}
-}{%
- \end{itemize}
-}
-
-\newcommand{\normalpreparation}{%
- \renewenvironment{preparationlist}{%
- \begin{itemize}
- }{%
- \end{itemize}
- }
-}
-
-\newcommand{\compactpreparation}{%
- \renewenvironment{preparationlist}{%
- \begin{itemize*}[label={},afterlabel={},itemjoin=\inlinelistmarker]
- }{%
- \end{itemize*}
- }
-}
-
-
-\newenvironment{ingredients}[1][Ingredients]{%
- \needspace{3\baselineskip}
- \subsection{#1}%
- \expandafter\setlist\expandafter{\ingredientsstyle}%
- \begin{ingredientlist}
-}{%
- \end{ingredientlist}
-}
-
-%\RequirePackage{pgfkeys}
-%\pgfkeys{
-% /myparbox/.is family, /myparbox,
-% width/.estore in = \myparboxWidth,
-% height/.estore in = \myparboxHeight,
-%}
-\newcommand{\ingred}[3]{%
-\item {#1}\space\notblank{#2}{#2\space}{}{#3}
-}
-
-\newenvironment{ingredientlist}{%
- \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}}
- \begin{itemize}
-}{%
- \end{itemize}
-}
-
-\newcommand{\tabularingredients}{%
- \renewcommand{\ingred}[3]{{##1}\space\notblank{##2}{##2}{} & {##3}\\}
- \renewenvironment{ingredientlist}{%
- \begin{tabular}{r l}
- }{%
- \end{tabular}
- }
-}
-
-\newcommand{\compactingredients}{%
- \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}}
- \renewenvironment{ingredientlist}{%
- \begin{itemize*}[label={},afterlabel={},itemjoin={;\space},noitemsep]
- }{%
- \end{itemize*}.
- }
-}
-
-\newcommand{\normalingredients}{%
- \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}}
- \renewenvironment{ingredientlist}{%
- \begin{itemize}
- }{%
- \end{itemize}
- }
-}
-
-\newenvironment{substitution}[1][Substitutes]{%
- \needspace{3\baselineskip}
- \subsection{#1}%
- \expandafter\setlist\expandafter{\substitutionstyle}%
- \begin{substitutionlist}
-}{%
- \end{substitutionlist}
-}
-
-\newenvironment{substitutionlist}{%
- \begin{itemize}
-}{%
- \end{itemize}
-}
-
-\newcommand{\normalinsubstitutions}{%
- \renewenvironment{substitutionlist}{%
- \begin{itemize}
- }{%
- \end{itemize}
- }
-}
-
-\newcommand{\compactinsubstitutions}{%
- \renewenvironment{substitutionlist}{%
- \begin{itemize*}[label={},afterlabel={},itemjoin={;\space},noitemsep]
- }{%
- \end{itemize*}.
- }
-}
-
-
-\newenvironment{instructions}[1][Cooking Instructions]{%
- \needspace{3\baselineskip}
- \subsection{#1}
- \expandafter\setlist\expandafter{\instructionsstyle}%
- \begin{instructionlist}
-}{
- \end{instructionlist}
-}
-
-\newenvironment{instructionlist}{%
- \begin{enumerate}
-}{%
- \end{enumerate}
-}
-
-\newcommand{\normalinstructions}{%
- \renewenvironment{instructionlist}{%
- \begin{enumerate}
- }{%
- \end{enumerate}
- }
-}
-
-\newcommand{\compactinstructions}{%
- \renewenvironment{instructionlist}{%
- \begin{enumerate*}[label={},afterlabel={},itemjoin=\inlinelistmarker]
- }{%
- \end{enumerate*}
- }
-}
-
-
-\newcommand{\startinstructions}{}
-
-\setlength{\footmarkwidth}{0pt}
-\setlength{\footmarksep}{0pt}
-\setlength{\footparindent}{0pt}
-\renewcommand{\foottextfont}{\small\sffamily\itshape\color{\darkhighlight}}
+\RequirePackage{relsize}
+
+% From http://tex.stackexchange.com/a/9266/226
+% to fix potential problems with opacity, colourspace
+% in PDF
+\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
+
+%% placeholders
+\newcommand{\recipetitle}{}
+\providelength{\tmplength}
+\providelength{\afterinsetphotoskip}
+\setlength{\afterinsetphotoskip}{1em}
+\def\@frontcoverphoto{}
+
+% keys for recipe sources
+\pgfkeys{
+ /recipe/.is family, /recipe,
+ author/.store in = \r@creditauthor,
+ authorurl/.store in = \r@authorurl,
+ license/.store in = \r@license,
+ licenseurl/.store in = \r@licenseurl,
+ author=,
+ authorurl=,
+ license=,
+ licenseurl=,
+}
+
+% keys for photos
+\pgfkeys{
+ /photo/.is family, /photo,
+ width/.store in = \@photowidth,
+ author/.store in = \p@creditauthor,
+ authorurl/.store in = \p@authorurl,
+ license/.store in = \p@license,
+ licenseurl/.store in = \p@licenseurl,
+ width=\linewidth,
+ author=,
+ authorurl=,
+ license=,
+ licenseurl=,
+}
+
+\def\@recipecredittext{}
+\def\@recipelicensetext{}
+\def\@photocredittext{}
+\def\@photolicensetext{}
+\def\citationtext{}
+
+\newcommand{\recipecredit}[2][]{%
+ \def\@recipecredittext{%
+ \ifblank{#1}{#2}{\href{#1}{#2}}}
+}
+\newcommand{\recipelicense}[2][]{%
+ \def\@recipelicensetext{, %
+ \ifblank{#1}{#2}{\href{#1}{#2}}}
+}
+\newcommand{\photocredit}[2][]{%
+ \def\@photocredittext{%
+ \ifblank{#1}{#2}{\href{#1}{#2}}}
+}
+\newcommand{\photolicense}[2][]{%
+ \def\@photolicensetext{, %
+ \ifblank{#1}{#2}{\href{#1}{#2}}}
+}
+
+\newcommand{\parserecipecitation}[1]{%
+ \def\r@creditauthor{}
+ \def\r@authorurl{}
+ \def\r@license{}
+ \def\r@licenseurl{}
+ \def\@recipecredittext{}
+ \def\@recipelicensetext{}
+ \pgfkeys{/recipe, #1}
+ \ifdefempty{\r@creditauthor}{}{%
+ \recipecredit[\ifdefempty{\r@authorurl}{}{\r@authorurl}]{\r@creditauthor}}
+ \ifdefempty{\r@license}{}{%
+ \recipelicense[\ifdefempty{\r@licenseurl}{}{\r@licenseurl}]{\r@license}}
+}
+
+\newcommand{\parsephotocitation}[1]{%
+ \def\p@creditauthor{}
+ \def\p@authorurl{}
+ \def\p@license{}
+ \def\p@licenseurl{}
+ \def\@photocredittext{}
+ \def\@photolicensetext{}
+ \pgfkeys{/photo, #1}
+ \ifdefempty{\p@creditauthor}{}{%
+ \photocredit[\ifdefempty{\p@authorurl}{}{\p@authorurl}]{\p@creditauthor}}
+ \ifdefempty{\p@license}{}{%
+ \photolicense[\ifdefempty{\p@licenseurl}{}{\p@licenseurl}]{\p@license}}
+}
+
+\newcommand{\frontcoverphoto}[2][]{%
+ \parsephotocitation{#1}
+ \def\@frontcoverphoto{#2}
+}
+
+\newcommand{\inlinecitationalignment}{\raggedright}
+\newcommand{\checkinlinecitation}{%
+\iftoggle{inlinecitations}{%
+ \ifdefempty{\@recipecredittext}{}{%
+ \vspace{-\aftersecskip}
+ {\inlinecitationalignment\sffamily\relsize{-1}\itshape By \@recipecredittext\ifdefempty{\@recipelicensetext}{}{\@recipelicensetext}.\par}
+ \vspace{\aftersecskip}}
+}{}
+}
+
+\iftoggle{endcitations}{\makepagenote}{}
+\def\blfootnote{\xdef\@thefnmark{}\@footnotetext}
+\renewcommand{\notesname}{Recipe and Photo Sources}
+\newcommand{\xpagenote}[1]{%
+ \unskip\begingroup\protected@edef\x{\endgroup\noexpand\pagenote{#1}}%
+ \scantokens\expandafter{\x\relax}}
+\renewcommand*{\notenumintext}[1]{}
+\renewcommand*{\notenuminnotes}[1]{}
+\renewcommand{\prenoteinnotes}{\item }
+\renewcommand{\postnoteinnotes}{}
+
+% For Inserts.
+% \DeclareInserts{25}{ad1.jpg, ad2.jpg, ad3.jpg, ad4.jpg}
+% \InsertAd will cycle through ad1.jpg -> ad4.jpg everytime
+% it is called.
+% It'll be called after every 25 recipes.
+\newarray\Inserts
+\newcounter{advertTotal}
+\newcounter{advertIdx}
+\newcounter{recipeIdx}
+\newcommand{\advertTotal}{\theadvertTotal}
+\newcommand{\DeclareInserts}[2]{%
+ \def\recipeAdCount{#1}
+ \renewcommand*{\do}[1]{%
+ \stepcounter{advertTotal}%
+ \Inserts(\arabic{advertTotal})={##1}
+ }
+ \docsvlist{#2}
+}
+\newcommand{\InsertAd}{%
+ \ifnumequal{\theadvertTotal}{0}{}{%
+ \thispagestyle{empty}
+ \stepcounter{advertIdx}%
+ \pgfmathparse{mod(\theadvertIdx - 1,\advertTotal) + 1}
+ \pgfmathtruncatemacro{\adIdx}{\pgfmathresult}%
+ \checkInserts(\adIdx)
+ \ThisTileWallPaper{\paperwidth}{\paperheight}{\cachedata}
+ \mbox{}\clearpage
+ }
+}
+
+
+%%% Hook for cover page etc
+% TODO: change this to use key options
+\newcommand{\makecover}[1][]{%
+\begin{titlingpage}
+\ifdefempty{\@frontcoverphoto}{%
+ \maketitle
+}{%
+ \ThisTileWallPaper{\paperwidth}{\paperheight}{\@frontcoverphoto}
+ \mbox{}\clearpage
+}
+\thispagestyle{empty}
+\ifstrequal{#1}{copyrightpage}{\clearpage\makecrpage}{}
+\end{titlingpage}%
+}
+
+\newcommand{\makecrpage}{%
+%\begin{titlingpage}
+\mbox{}
+\vfill
+\relsize{-1}
+Recipe compilation by \theauthor.
+\ifdefempty{\@frontcoverphoto}{}{%
+ \ifdefempty{\@photocredittext}{}{%
+ Front cover photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.
+ }
+}
+\\
+\\
+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.\\
+Book design and themes by \href{http://liantze.penguinattack.org}{Lian Tze Lim}.
+%\end{titlingpage}%
+}
+
+\patchcommand{\mainmatter}{}{%
+%%% turn off sectional numberings
+\setcounter{secnumdepth}{-1}
+\setcounter{tocdepth}{1}
+%% set end notes to be an itemised list
+\addtonotes{\protect\begin{itemize}[label=\itemmarker,nosep,leftmargin=*]}
+}
+
+%%% Overview as a bit of a chapter introduction
+\newenvironment{overview}[1]{%
+\chapter*{#1}
+\providelength{\oldparskip}
+\setlength{\oldparskip}{\parskip}
+\setlength{\parskip}{\onelineskip}
+}{%
+\setlength{\parskip}{\oldparskip}
+\clearpage
+}
+
+%%%% TODO cooking time, preparation time, portion... "atomic" fields
+\newcommand{\ovenstyle}{}
+\newcommand{\oven}[1]{\makebox{\ovenstyle Preheat oven to #1}\par}
+
+\newcommand{\maintextcolor}{black}
+\newcommand{\primarycolor}{blue}
+\newcommand{\secondarycolor}{blue!80}
+\newcommand{\tertiarycolor}{blue!60}
+\newcommand{\primarycolorcomplement}{white}
+\newcommand{\secondarycolorcomplement}{white}
+\newcommand{\tertiarycolorcomplement}{white}
+\newcommand{\darkhighlight}{red!80!black}
+\newcommand{\brighthighlight}{red}
+\newcommand{\highlightcolor}{\darkhighlight}
+\newcommand{\externallinkcolor}{SteelBlue}
+
+\newcommand{\scriptdefault}{pzc}
+\newcommand{\scriptfamily}{\fontfamily{\scriptdefault}\selectfont}
+
+\newcommand{\recipecolor}{\highlightcolor}
+\newcommand{\recipefamily}{\sffamily}
+\newcommand{\recipesize}{\LARGE}
+\newcommand{\recipestyle}{\bfseries}
+\newcommand{\recipefont}{\recipefamily\recipesize\color{\recipecolor}\recipestyle}
+
+\newcommand{\headingcolor}{\primarycolor}
+\newcommand{\headingfamily}{\sffamily}
+\newcommand{\headingsize}{\large}
+\newcommand{\headingstyle}{\itshape}
+\newcommand{\headingfont}{\headingfamily\headingsize\color{\headingcolor}\headingstyle}
+
+\renewcommand{\chaptitlefont}{\recipefamily\color{\recipecolor}\bfseries\HUGE\centering}
+\setsecheadstyle{\recipefont}
+\setsubsecheadstyle{\headingfont}
+
+\newcommand{\headingmarker}{\textbullet}
+\newcommand{\itemmarker}{\textbullet}
+\newcommand{\enumeratemarker}[1]{#1.}
+\newcommand{\inlinelistmarker}{\makebox[1.5em][c]{\textbullet}}
+
+\newcommand{\equipmentstyle}{leftmargin=*}
+\newcommand{\ingredientsstyle}{label=\textbullet,leftmargin=*}
+\newcommand{\preparationstyle}{label=\textbullet,leftmargin=*}
+\newcommand{\substitutionstyle}{label=\textbullet,leftmargin=*}
+\newcommand{\instructionsstyle}{label={\arabic*. },leftmargin=*}
+
+
+%%%% 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}[2][]{%
+ \parserecipecitation{#1}
+ \clearpage%
+ \color{\maintextcolor}%
+ \section{#2}
+ \checkinlinecitation
+}{}
+
+\renewcommand{\memsecinfo}[5]{%
+ \ifstrequal{#1}{section}{\renewcommand{\recipetitle}{#3}}{}
+}
+
+\AtBeginEnvironment{recipe}{%
+ \def\@recipecredittext{}
+ \def\@recipelicensetext{}
+ \def\@photocredittext{}
+ \def\@photolicensetext{}
+ \def\citationtext{}
+}
+
+\AtEndEnvironment{recipe}{%
+ \ifdefempty{\@recipecredittext}{}{\apptocmd{\citationtext}{By \@recipecredittext\ifdefempty{\@recipelicensetext}{}{\@recipelicensetext}.}{}{}}
+ \ifdefempty{\@photocredittext}{}{\apptocmd{\citationtext}{ Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.}{}{}}
+ \iftoggle{footercitations}{%
+ \ifdefempty{\citationtext}{}{\blfootnote{\citationtext}}
+ }{}
+ \iftoggle{endcitations}{%
+ \ifdefempty{\citationtext}{}{\leavevmode\xpagenote{\textcolor{\darkhighlight}{\sffamily\bfseries\recipetitle}\space\textit{(p.\thepage)}\enspace\citationtext}}
+ }{}
+}
+
+\AfterEndEnvironment{recipe}{%
+ % Check if an ad should be inserted
+ \ifdef{\recipeAdCount}{
+ \ifnumgreater{\theadvertTotal}{0}{
+ \stepcounter{recipeIdx}
+ \pgfmathparse{mod(\therecipeIdx,\recipeAdCount)}
+ \pgfmathtruncatemacro{\recIdx}{\pgfmathresult}
+ \ifnumequal{\recIdx}{0}{\afterpage{\InsertAd}}{}
+ }{}
+ }{}
+}
+
+\newcommand{\insetphoto}[2][width=.4\textwidth]{%
+ \parsephotocitation{#1}
+ \includegraphics[width=\@photowidth]{#2}\par
+}
+
+\newcommand{\fullpagephoto}[2][]{%
+ \afterpage{%
+ \parsephotocitation{#1}
+ \ThisTileWallPaper{\paperwidth}{\paperheight}{#2}
+ \iftoggle{clearpn}{\thispagestyle{empty}}{}
+ \iftoggle{inlinecitations}{%
+ \ifdefempty{\@photocredittext}{}{%
+ \begin{tikzpicture}[overlay,remember picture]
+ \node[fill=white,fill opacity=.8,text opacity=1,font=\relsize{-1}\sffamily\itshape,
+ anchor=north east,xshift=-.5in,yshift=-.5in]
+ at (current page.north east)
+ {Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
+ \end{tikzpicture}
+ }
+ }{}
+ \mbox{}\clearpage}
+}
+
+\newcommand{\checkfiller}{%
+ \iftoggle{print}{%
+ \clearpage
+ \checkoddpage\strictpagecheck
+% \ifoddpage\ThisTileWallPaper{\paperwidth}{\paperheight}{photo/filler1}\mbox{}\clearpage\fi
+ \ifoddpage\InsertAd\fi
+ }{}
+}
+
+%\newcommand{\photo}[2][]{\insetphoto[#1]{#2}}
+
+\newcommand{\SpreadWallPaperLeft}[1]{%
+ \sbox0{\includegraphics{#1}}%
+ \AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
+ \parbox[b][\paperheight]{\paperwidth}{%
+ \vfill
+ \centering
+ \includegraphics[width=\paperwidth,height=\paperheight,clip,trim=0 0 {.5\wd0} 0]{#1}%
+ \vfill
+ }}}
+% \iftoggle{clearpn}{\thispagestyle{empty}}{}
+}
+
+\newcommand{\SpreadWallPaperRight}[1]{%
+ \sbox0{\includegraphics{#1}}%
+ \AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
+ \parbox[b][\paperheight]{\paperwidth}{%
+ \vfill
+ \centering
+ \includegraphics[width=\paperwidth,height=\paperheight,clip,trim={.5\wd0} 0 0 0]{#1}%
+ \vfill
+ }}}
+ \iftoggle{clearpn}{\thispagestyle{empty}}{}
+ \iftoggle{inlinecitations}{%
+ \ifdefempty{\@photocredittext}{no}{%
+ \begin{tikzpicture}[overlay,remember picture]
+ \node[fill=white,fill opacity=.8,text opacity=1,font=\relsize{-1}\sffamily\itshape,
+ anchor=north east,xshift=-.5in,yshift=-.5in]
+ at (current page.north east)
+ {Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
+ \end{tikzpicture}
+ }
+ }{}
+
+}
+
+\newcommand{\landscapedphoto}[2][]{%
+ \parsephotocitation{#1}
+ \AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
+ \parbox[b][\paperheight]{\paperwidth}{%
+ \vfill
+ \centering
+ \includegraphics[width=\paperheight,height=\paperwidth,angle=90]{#2}%
+ \vfill
+ }}}
+ \iftoggle{inlinecitations}{%
+ \ifdefempty{\@photocredittext}{}{%
+ \begin{tikzpicture}%[overlay,remember picture]
+ \node[fill=white,fill opacity=.8,text opacity=1,font=\relsize{-1}\sffamily\itshape,
+ %anchor=north west,%xshift=.5in,yshift=-.5in
+ ]
+ %at (current page.north)
+ {Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
+ \end{tikzpicture}
+ }
+ }{}
+}
+
+\newcommand{\twopagespreadphoto}[2][]{%
+ \iftoggle{print}{%
+ \SpreadWallPaperLeft{#2}
+ \mbox{}\clearpage
+ \afterpage{\parsephotocitation{#1}
+ \SpreadWallPaperRight{#2}
+ \mbox{}\clearpage}
+ }{\afterpage{%
+ \begin{landscape}
+ \thispagestyle{empty}
+ \landscapedphoto[#1]{#2}\mbox{}\clearpage
+ \end{landscape}
+ }}
+}
+
+\AtBeginDocument{%
+ \iftoggle{inlinecitations}{%
+ % See http://tex.stackexchange.com/a/68741/226
+ \expandafter\apptocmd\csname\string\insetphoto\endcsname{%
+ \ifdefempty{\@photocredittext}{}{\vskip-\afterinsetphotoskip
+ {\centering\relsize{-1}\sffamily\itshape Photo courtesy \@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.\par}
+ \vskip\afterinsetphotoskip
+ }%
+ }{}{}
+ }{}
+}
+
+\newenvironment{equipment}[1][Equipment]{%
+ \needspace{3\baselineskip}
+ \subsection{#1}
+ \expandafter\setlist\expandafter{\equipmentstyle}%
+ \begin{equipmentlist}
+}{%
+ \end{equipmentlist}
+}
+
+\newenvironment{equipmentlist}{%
+ \begin{description}
+}{%
+ \end{description}
+}
+
+\newcommand{\compactequipment}{%
+ \renewenvironment{equipmentlist}{%
+ \begin{description*}[mode=unboxed,leftmargin=*,itemjoin=\inlinelistmarker]
+ }{%
+ \end{description*}.
+ }
+}
+
+\newcommand{\normalequipment}{%
+ \renewenvironment{equipmentlist}{%
+ \begin{description}
+ }{%
+ \end{description}
+ }
+}
+
+\newenvironment{preparation}[1][Preparation]{%
+ \needspace{3\baselineskip}
+ \subsection{#1}
+ \expandafter\setlist\expandafter{\preparationstyle}%
+ \begin{preparationlist}
+}{%
+ \end{preparationlist}
+}
+
+\newenvironment{preparationlist}{%
+ \begin{itemize}
+}{%
+ \end{itemize}
+}
+
+\newcommand{\normalpreparation}{%
+ \renewenvironment{preparationlist}{%
+ \begin{itemize}
+ }{%
+ \end{itemize}
+ }
+}
+
+\newcommand{\compactpreparation}{%
+ \renewenvironment{preparationlist}{%
+ \begin{itemize*}[label={},afterlabel={},itemjoin=\inlinelistmarker]
+ }{%
+ \end{itemize*}
+ }
+}
+
+
+\newenvironment{ingredients}[1][Ingredients]{%
+ \needspace{3\baselineskip}
+ \subsection{#1}%
+ \expandafter\setlist\expandafter{\ingredientsstyle}%
+ \begin{ingredientlist}
+}{%
+ \end{ingredientlist}
+}
+
+\newcommand{\ingred}[3]{%
+\item {#1}\space\notblank{#2}{#2\space}{}{#3}
+}
+
+\newenvironment{ingredientlist}{%
+ \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}}
+ \begin{itemize}
+}{%
+ \end{itemize}
+}
+
+\newcommand{\tabularingredients}{%
+ \renewcommand{\ingred}[3]{{##1}\space\notblank{##2}{##2}{} & {##3}\\}
+ \renewenvironment{ingredientlist}{%
+ \begin{tabular}{r l}
+ }{%
+ \end{tabular}
+ }
+}
+
+\newcommand{\compactingredients}{%
+ \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}}
+ \renewenvironment{ingredientlist}{%
+ \begin{itemize*}[label={},afterlabel={},itemjoin={;\space},noitemsep]
+ }{%
+ \end{itemize*}.
+ }
+}
+
+\newcommand{\normalingredients}{%
+ \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}}
+ \renewenvironment{ingredientlist}{%
+ \begin{itemize}
+ }{%
+ \end{itemize}
+ }
+}
+
+\newenvironment{substitution}[1][Substitutes]{%
+ \needspace{3\baselineskip}
+ \subsection{#1}%
+ \expandafter\setlist\expandafter{\substitutionstyle}%
+ \begin{substitutionlist}
+}{%
+ \end{substitutionlist}
+}
+
+\newenvironment{substitutionlist}{%
+ \begin{itemize}
+}{%
+ \end{itemize}
+}
+
+\newcommand{\normalinsubstitutions}{%
+ \renewenvironment{substitutionlist}{%
+ \begin{itemize}
+ }{%
+ \end{itemize}
+ }
+}
+
+\newcommand{\compactinsubstitutions}{%
+ \renewenvironment{substitutionlist}{%
+ \begin{itemize*}[label={},afterlabel={},itemjoin={;\space},noitemsep]
+ }{%
+ \end{itemize*}.
+ }
+}
+
+
+\newenvironment{instructions}[1][Cooking Instructions]{%
+ \needspace{3\baselineskip}
+ \subsection{#1}
+ \expandafter\setlist\expandafter{\instructionsstyle}%
+ \begin{instructionlist}
+}{
+ \end{instructionlist}
+}
+
+\newenvironment{instructionlist}{%
+ \begin{enumerate}
+}{%
+ \end{enumerate}
+}
+
+\newcommand{\normalinstructions}{%
+ \renewenvironment{instructionlist}{%
+ \begin{enumerate}
+ }{%
+ \end{enumerate}
+ }
+}
+
+\newcommand{\compactinstructions}{%
+ \renewenvironment{instructionlist}{%
+ \begin{enumerate*}[label={},afterlabel={},itemjoin=\inlinelistmarker]
+ }{%
+ \end{enumerate*}
+ }
+}
+
+
+\newcommand{\startinstructions}{}
+
+\setlength{\footmarkwidth}{0pt}
+\setlength{\footmarksep}{0pt}
+\setlength{\footparindent}{0pt}
+\renewcommand{\foottextfont}{\sffamily\itshape\color{\darkhighlight}}
\renewcommand*{\footnoterule}{}
theme/Modern.tex
\normalequipment
-\renewcommand{\insetphoto}[2][\linewidth]{%
- \includegraphics[width=#1]{#2}\par\vspace{\afterinsetphotoskip}
+\makeatletter
+\renewcommand{\insetphoto}[2][]{%
+ \parsephotocitation{#1}
+ \includegraphics[width=\@photowidth]{#2}\par\vspace{\afterinsetphotoskip}
}
-
+\makeatother
theme/Notebook.tex
%\pgfmathsetseed{\pdfuniformdeviate 10000000}
%\pgfmathsetseed{1}
-\providecommand{\rotatepic}[1]{%
+\providecommand{\rotatepic}[2][\linewidth]{%
\noindent\raggedright%
\begin{tikzpicture}
-\node[rotate={rand*4.0},inner sep=1em,draw=gray!60,fill=white, blur shadow={shadow blur steps=5,shadow xshift=1ex,shadow yshift=-1ex,shadow opacity=20,shadow blur radius=1ex}]{\includegraphics[width=.85\linewidth]{#1}};
+\pgfmathsetlength{\tmplength}{.85 * #1}
+\node[rotate={rand*4.0},inner sep=1em,draw=gray!60,fill=white, blur shadow={shadow blur steps=5,shadow xshift=1ex,shadow yshift=-1ex,shadow opacity=20,shadow blur radius=1ex}]{\includegraphics[width=\tmplength]{#2}};
\end{tikzpicture}
}
-\renewcommand{\insetphoto}[1]{\rotatepic{#1}\par\bigskip}
+\makeatletter
+\renewcommand{\insetphoto}[2][]{%
+\parsephotocitation{#1}
+\rotatepic[\@photowidth]{#2}\par\bigskip}
+\makeatother
xsl/latex.xsl
<xsl:text>\checkfiller&#xa;</xsl:text>
</xsl:if>
- <xsl:text>\begin{recipe}{</xsl:text>
+ <xsl:text>\begin{recipe}</xsl:text>
+ <xsl:apply-templates select="description/citation[descendant::*]" />
+ <xsl:text>{</xsl:text>
<xsl:apply-templates select="description/title" />
<xsl:text>}&#xa;</xsl:text>
<xsl:apply-templates select="description/photo[@use='recipe-inset']" mode="recipe" />
<xsl:apply-templates />
<xsl:apply-templates select="description/photo[@use='one-page' or @use='two-page']" mode="recipe" />
<xsl:text>\end{recipe}&#xa;&#xa;</xsl:text>
</xsl:template>
<xsl:template match="photo[@use='front-cover']" mode="book">
- <xsl:apply-templates select="citation[descendant::*]" />
<xsl:apply-templates select="uri" mode="book" />
</xsl:template>
<xsl:template match="photo[@use='overview']" mode="book" />
<xsl:template match="photo[@use='recipe-inset']" mode="recipe">
- <xsl:apply-templates select="citation[descendant::*]" />
<xsl:apply-templates select="uri" mode="recipe-inset" />
</xsl:template>
<xsl:template match="photo[@use='one-page']" mode="recipe">
- <xsl:apply-templates select="citation[descendant::*]" />
<xsl:apply-templates select="uri" mode="one-page" />
</xsl:template>
<xsl:template match="photo[@use='two-page']" mode="recipe">
- <xsl:apply-templates select="citation[descendant::*]" />
<xsl:apply-templates select="uri" mode="two-page" />
</xsl:template>
<xsl:template match="uri" mode="book-overview">
<xsl:text>\begin{wrapfigure}{l}{.45\textwidth}&#xa;</xsl:text>
- <xsl:text>\insetphoto[\linewidth]{</xsl:text>
+ <xsl:text>\insetphoto</xsl:text>
+ <xsl:apply-templates select="following-sibling::citation[descendant::*]" />
+ <xsl:text>{</xsl:text>
<xsl:apply-templates />
<xsl:text>}&#xa;</xsl:text>
<xsl:text>\end{wrapfigure}&#xa;&#xa;</xsl:text>
</xsl:template>
<xsl:template match="uri" mode="book">
<xsl:if test="$book-front-cover">
- <xsl:text>\frontcoverphoto{</xsl:text>
+ <xsl:text>\frontcoverphoto</xsl:text>
+ <xsl:apply-templates select="following-sibling::citation[descendant::*]" />
+ <xsl:text>{</xsl:text>
<xsl:apply-templates />
<xsl:text>}&#xa;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="uri" mode="recipe-inset">
- <xsl:text>\insetphoto{</xsl:text>
+ <xsl:text>\insetphoto</xsl:text>
+ <xsl:apply-templates select="following-sibling::citation[descendant::*]" />
+ <xsl:text>{</xsl:text>
<xsl:apply-templates />
<xsl:text>}&#xa;</xsl:text>
</xsl:template>
<xsl:template match="uri" mode="one-page">
- <xsl:text>\fullpagephoto{</xsl:text>
+ <xsl:text>\fullpagephoto</xsl:text>
+ <xsl:apply-templates select="following-sibling::citation[descendant::*]" />
+ <xsl:text>{</xsl:text>
<xsl:apply-templates />
<xsl:text>}&#xa;</xsl:text>
</xsl:template>
<xsl:template match="uri" mode="two-page">
- <xsl:text>\twopagespreadphoto{</xsl:text>
+ <xsl:text>\twopagespreadphoto</xsl:text>
+ <xsl:apply-templates select="following-sibling::citation[descendant::*]" />
+ <xsl:text>{</xsl:text>
<xsl:apply-templates />
<xsl:text>}&#xa;</xsl:text>
</xsl:template>
-<xsl:template match="photo/citation[descendant::*]">
+<xsl:template match="citation[descendant::*]">
+ <xsl:text>[</xsl:text>
<xsl:if test="author">
- <xsl:text>\photocredit</xsl:text>
+ <xsl:text>author={</xsl:text>
+ <xsl:apply-templates select="author" mode="escape" />
+ <xsl:text>},</xsl:text>
+ </xsl:if>
+ <xsl:if test="author/@url">
+ <xsl:text>authorurl={</xsl:text>
+ <xsl:apply-templates select="author/@url" mode="escape" />
+ <xsl:text>},</xsl:text>
+ </xsl:if>
+ <xsl:if test="license">
+ <xsl:text>license={</xsl:text>
+ <xsl:apply-templates select="license" mode="escape" />
+ <xsl:text>},</xsl:text>
+ </xsl:if>
+ <xsl:if test="license/@url">
+ <xsl:text>licenseurl={</xsl:text>
+ <xsl:apply-templates select="license/@url" mode="escape" />
+ <xsl:text>},</xsl:text>
+ </xsl:if>
+ <xsl:text>]</xsl:text>
+</xsl:template>
+
+<!--
+<xsl:template match="description/citation[descendant::*]">
+ <xsl:if test="author">
+ <xsl:text>\recipecredit</xsl:text>
<xsl:if test="author/@url">
<xsl:text>[</xsl:text>
<xsl:if test="license">
- <xsl:text>\photolicense</xsl:text>
+ <xsl:text>\recipelicense</xsl:text>
<xsl:if test="license/@url">
<xsl:text>[</xsl:text>
</xsl:if>
</xsl:template>
+-->
<xsl:template match="description/title">
Delta 689 lines added, 566 lines removed, 123-line increase