-
Notifications
You must be signed in to change notification settings - Fork 48
/
html-plain.cfg
73 lines (61 loc) · 2.48 KB
/
html-plain.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
\Preamble{xhtml}
\RequirePackage{ifthen}
\ifthenelse{\isundefined{\citeurl}}{}{
\renewcommand{\citeurl}[5]{\HCode{<a href="#5" title="#2, #3">}#1\HCode{</a>}}
}
% \renewcommand{\code}[1]{\lstinline!#1!}
% \renewcommand{\java}[1]{\code{#1}}
% \renewcommand{\py}[1]{\code{#1}}
% \renewcommand{\stcode}[1]{\code{#1}}
% \renewcommand{\rbcode}[1]{\code{#1}}
% \def{\code}[1]{\lstinline!#1!}
% \def{\java}[1]{\code{#1}}
% \def{\py}[1]{\code{#1}}
% \def{\stcode}[1]{\code{#1}}
% \def{\rbcode}[1]{\code{#1}}
\renewcommand{\textit}[1]{\HCode{<em>}#1\HCode{</em>}}
\renewcommand{\textbf}[1]{\HCode{<strong>}#1\HCode{</strong>}}
\renewcommand{\emph}[1]{\HCode{<em>}#1\HCode{</em>}}
\renewcommand{\texttt}[1]{\HCode{<code>}#1\HCode{</code>}}
\renewcommand{\textbackslash}{\HCode{!!TEXTBACKSLASH!!}}
\Configure{()}{\HCode{<span class="math">}}{\HCode{</span>}}
% \Configure{footnote}{\HCode{<span>FOT1}}{\HCode{FOT2</span>}}
\Configure{footnote}{}{}{}{}
\Configure{footnotetext}{\HCode{<span class="sidenote">}}{}{\HCode{</span>}}
\Configure{footnotemark}{}{}
\Configure{section}{\HCode{<section>}}{\HCode{</section>}}{\HCode{<h2>}\arabic{section}\HCode{ }}{\HCode{</h2>}}
\Configure{subsection}{}{}{\HCode{<h3>}\arabic{section}.\arabic{subsection}\HCode{ }}{\HCode{</h3>}}
\Configure{HtmlPar}{\HCode{<p>}}{\EndP\HCode{<p>}}{\HCode{</p>}}{\HCode{</p>}}
\Configure{caption}{\HCode{<figcaption><span class="fignum">}}{:\HCode{</span>} }{}{\HCode{</figcaption>}}
\ConfigureEnv{figure}{\EndP\HCode{<figure>}}{\HCode{</figure>}}{}{}
\Configure{float}{}{}{}{}
\makeatletter
\ifthenelse{\isundefined{\knitrForHt}}{}{ % this is brittle, but oh well
\renewenvironment{knitrout}{
\renewcommand{\@iinput}[1]{TODO: convert to image: {##1}}%
}{}
}
\makeatother
\ifthenelse{\isundefined{\lstinline}}{}{
% else
\Configure{lstinline}{\HCode{<code>}}{\HCode{</code>}}
\ConfigureEnv{lstlisting}
{\ifvmode \IgnorePar\fi \EndP
\gHAdvance\listingN by 1
\gdef\start:LstLn{%
\HCode{<figure><div><div class="linenumbers"></div><pre><code>}%
\gdef\start:LstLn{\leavevmode\special{t4ht@+\string&{35}x000A{59}}x}}%%% this special string thing inserts an HTML entity for a newline... didn't find another way
\bgroup
\Configure{listings}
{{\everypar{}\leavevmode}}
{{\everypar{}\leavevmode}}
{\start:LstLn }
{}%
}
{\egroup
\ifvmode \IgnorePar\fi \EndP \HCode{</code></pre></div></figure>}\par}
{} {}
% done configuring listing
}
\begin{document}
\EndPreamble