Skip to content

Commit 0c577c2

Browse files
authored
Move latex code from Lua filter to Latex template. (#264)
This allows the behavior of these filters to be customized by tweaking the Latex template. This change also removes some dead code as there was no way to exercise a certain filter.
1 parent 156e37b commit 0c577c2

File tree

4 files changed

+14
-26
lines changed

4 files changed

+14
-26
lines changed

build.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,6 @@ cat <<- EOF > ./.puppeteer.json
563563
}
564564
EOF
565565

566-
if [ "${BLOCK_QUOTES_ARE_INFORMATIVE_TEXT}" == "yes" ]; then
567-
EXTRA_PANDOC_OPTIONS+=" --lua-filter=informative-quote-blocks.lua"
568-
fi
569-
570566
# Use sed to perform some basic fixups on certain input files.
571567
#
572568
# If the second argument is provided and is "html", strip out `\listoffigures` and `\listoftables`,

filter/divide-code-blocks.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@ function CodeBlock(block)
2626
font = class_spec["font"]
2727
return {
2828
pandoc.RawInline('latex', string.format([[
29-
\vskip 3pt
30-
\begin{customcodeblock}
31-
\textbf{\textit{\textcolor{codeblock-header}{\small \BeginDemarcated{Code}}}}
32-
%s
29+
\BeginCodeBlock{%s}
3330
]], font)),
3431
block,
3532
pandoc.RawInline('latex', [[
36-
\textbf{\textit{\textcolor{codeblock-header}{\small \EndDemarcated{Code}}}}
37-
\end{customcodeblock}
33+
\EndCodeBlock
3834
]]),
3935
}
4036
end

filter/informative-quote-blocks.lua

Lines changed: 0 additions & 16 deletions
This file was deleted.

template/tcg.tex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@
8282
\EndAccSupp{}%
8383
}
8484

85+
\newcommand{\BeginCodeBlock}[1]{
86+
\vskip 3pt
87+
\begin{customcodeblock}
88+
\textbf{\textit{\textcolor{codeblock-header}{\small \BeginDemarcated{Code}}}}
89+
#1
90+
}
91+
92+
\newcommand{\EndCodeBlock}{
93+
\textbf{\textit{\textcolor{codeblock-header}{\small \EndDemarcated{Code}}}}
94+
\end{customcodeblock}
95+
}
96+
8597
% Use upquote if available, for straight quotes in verbatim environments
8698
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
8799
\IfFileExists{microtype.sty}{% use microtype if available

0 commit comments

Comments
 (0)