70
|
1 %//////////////////////////////////////////////////////////////////////////////
|
|
2 %
|
|
3 % Copyright (c) 2015-2016 Tassilo Philipp <tphilipp@potion-studios.com>
|
|
4 %
|
|
5 % Permission to use, copy, modify, and distribute this software for any
|
|
6 % purpose with or without fee is hereby granted, provided that the above
|
|
7 % copyright notice and this permission notice appear in all copies.
|
|
8 %
|
|
9 % THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10 % WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11 % MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12 % ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13 % WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14 % ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15 % OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16 %
|
|
17 %//////////////////////////////////////////////////////////////////////////////
|
|
18
|
69
|
19 % Set html output type and how the pages will be organized; index=a,b,c means a
|
|
20 % column index, b depth partitioning per page, and if c is present and 'next',
|
|
21 % that next-links recurses.
|
|
22 % Use b=1 for outputting one big html page. b=2 would partition by sections, b=3
|
|
23 % by sections and subsections, and so on...
|
72
|
24 \Preamble{html,info,index=2,1,pic-tabular,pic-align,charset="utf-8",p-width}
|
69
|
25 % For manual partitioning we use b=1 above, then \CutAt
|
|
26 %\CutAt{subsubsection,subsection,likesubsection,section,likesection,part}
|
|
27 \CutAt{section}
|
|
28
|
|
29 %% Don't want TOC to be on own page.
|
|
30 %\ConfigureToc{likesubsubsection}{}{~}{}{ }
|
|
31
|
|
32 % Here goes stuff that should be *before* <head>...</head>
|
|
33 % Use it for configurations, no actual output.
|
|
34
|
|
35 \Configure{VERSION}{}
|
|
36 \Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
|
0
|
37 \Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
|
71
|
38 \Configure{BODY}{\HCode{\Hnewline<body>\Hnewline<div class="mainDiv">\Hnewline}}{\HCode{\Hnewline</div></body>}} % KEEP the body on it's own line, as it's used as a marker for postprocessing.
|
69
|
39
|
70
|
40 % TITLE+ is only on main page, other use section title. Prefix everything, though.
|
|
41 \Configure{TITLE}{\HCode{<title>}dyncall Manual - }{\HCode{</title>}}
|
|
42 \Configure{TITLE+}{Index}
|
|
43
|
69
|
44 % Clear default header, define our custom one. Using @HEAD will make this be used on all pages generated.
|
0
|
45 \Configure{@HEAD}{}
|
|
46 \Configure{@HEAD}{\HCode{<meta http-equiv="content-type" content="text/html; charset=utf-8"/>\Hnewline}}
|
|
47 \Configure{@HEAD}{\HCode{<meta name="resource-type" content="document"/>\Hnewline}}
|
|
48 \Configure{@HEAD}{\HCode{<meta name="keywords" content="C, function, dynamic, call, calling, convention, VM, abstraction, closure"/>\Hnewline}}
|
|
49 \Configure{@HEAD}{\HCode{<meta name="distribution" content="global"/>\Hnewline}}
|
|
50 \Configure{@HEAD}{\HCode{<link rel="stylesheet" id="dyn-fonts-css" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&subset=latin,latin-ext" type="text/css" media="all"/>\Hnewline}}
|
|
51 % should this really rely on online content (dyncall's .css) even for an offline build? @@@
|
|
52 \Configure{@HEAD}{\HCode{<link rel="stylesheet" href="http://dyncall.org/data/main.css" type="text/css" media="all"/>\Hnewline}}
|
69
|
53
|
70
|
54 % Make TOC display as nested "ul"s.
|
|
55 \Configure{tableofcontents} {}{\tocItem{0}}{}{}{}
|
|
56 \ConfigureToc{section} {}{\tocItem{1}{\HCode{<li>}}}{}{}
|
|
57 \ConfigureToc{subsection} {}{\tocItem{2}{\HCode{<li>}}}{}{}
|
|
58 \ConfigureToc{subsubsection} {}{\tocItem{3}{\HCode{<li>}}}{}{}
|
|
59
|
|
60 % Logic to open/close "ul"s correctly.
|
|
61 \newcount\c
|
|
62 \def\tocItem#1{%
|
|
63 \loop
|
|
64 \ifnum \c<#1
|
|
65 \advance\c by 1
|
|
66 \HCode{<ul>}
|
|
67 \else
|
|
68 \ifnum \c>#1
|
|
69 \advance\c by -1
|
|
70 \HCode{</li></ul>}
|
|
71 \fi
|
|
72 \ifnum \c=#1
|
|
73 \ifnum #1>0 \HCode{</li>} \fi
|
|
74 \fi
|
|
75 \fi
|
|
76 \unless\ifnum \c=#1 \repeat
|
|
77 }
|
|
78
|
72
|
79 % Define layout of tables - for some reason tabular* renders fine
|
|
80 % when pic-tabular is *not* used. When it is, it converts tabular
|
|
81 % (without the asterisk) into pictures, but also changes the rendering
|
|
82 % of tabular*, which we then mend with the code below. Not sure if
|
|
83 % this is just a hack around a tex4ht bug, but it nicely lets us
|
|
84 % pick which table should be a picture or not.
|
|
85 \Configure{tabular}
|
|
86 {\HCode{<table>}}
|
|
87 {\HCode{</table>}}
|
|
88 {\HCode{<tr>}} %{\HCode{<tr class="row-\HRow">}}
|
|
89 {\HCode{</tr>}}
|
|
90 {\HCode{<td \ifnum \HMultispan>1 colspan="\HMultispan"\fi >}}
|
|
91 {\HCode{</td>}}
|
|
92
|
|
93 % @@@ Did not get that below to work, and don't understand it, either.
|
|
94 % @@@ Default output is ok, so we're simply changing class name in
|
|
95 % @@@ instead of this postprocessing. See Makefile.
|
|
96 %% Listings, so that caption below isn't in same block
|
|
97 %\def\listingLineReset{\newcount\lstlineno}
|
|
98 %\def\listingLine{\advance\lstlineno by 1}
|
|
99 %\ConfigureEnv{lstlisting}{\listingLineReset\Tg<div class="ttDiv">}{\Tg</div>}{}{}
|
|
100 %\Configure{listings}{}{}{}{\ifnum \lstlineno>0 \Tg<br> \fi \listingLine}
|
|
101
|
|
102 % Make listing/table captions nicer.
|
|
103 \Configure{caption}
|
|
104 {\Tg<div class="caption" style="margin-top:-1em;text-align:right;color:\#A0A0A0">}
|
|
105 {\HCode{<span class="id">}}
|
|
106 {\HCode{</span>: <span class="content">}}
|
|
107 {\HCode{</div>}}
|
|
108
|
|
109 % All kinds of style setting for fonts, as we don't use the autogenerated
|
|
110 % css file, but dyncall's website one.
|
|
111 \Configure{texttt}{}{}
|
|
112 \Configure{textit}{}{}
|
|
113 \Configure{textrm}{}{}
|
|
114 \Configure{textup}{}{}
|
|
115 \Configure{textsl}{}{}
|
|
116 \Configure{textsf}{}{}
|
|
117 \Configure{textbf}{}{}
|
|
118 \Configure{textsc}{}{}
|
|
119 \Configure{emph}{\Tg<em>}{\Tg</em>}
|
|
120
|
|
121
|
|
122 %\lstset{ language=C, basicstyle=\ttfamily, numbers=left,
|
|
123 %numberstyle=\tiny, numbersep=10pt, showstringspaces=false}
|
|
124
|
|
125 %http://www.itisnotoverengineering.com/2013/06/syntax-highlighting-with-tex4ht.html
|
|
126
|
|
127 % Simplest possible paragraphs
|
|
128 \Configure{HtmlPar}{\EndP\Tg<p >}{\EndP\Tg<p>}{\HCode{</p>\Hnewline}}{\HCode{</p>\Hnewline}}
|
|
129
|
|
130
|
|
131
|
70
|
132 % On site navigation texts
|
|
133 \Configure{crosslinks}%
|
|
134 {}%left delimiter
|
|
135 {}%right delimiter
|
|
136 {next}%
|
|
137 {previous}%
|
|
138 {}%previous-tail
|
|
139 {}%front
|
|
140 {}%tail
|
|
141 {index}%up
|
|
142
|
|
143 % Which nav links to show
|
|
144 \Configure{crosslinks*}%
|
|
145 {prev}%
|
|
146 {up}%
|
|
147 {next}%
|
|
148 {}%
|
|
149
|
|
150 % What's around top and bottom links section
|
|
151 \Configure{crosslinks+}%
|
|
152 {\HCode{<div style="width:100\%;text-align:left"><div style="width:30\%;display:inline-block;text-align:left">}}%
|
|
153 {\HCode{</div></div><hr>}}%
|
|
154 {\HCode{<hr><div style="width:100\%;text-align:left"><div style="width:30\%;display:inline-block;text-align:left">}}%
|
|
155 {\HCode{</div></div>}}%
|
|
156
|
|
157 % Hacky - output div stuff before specific crosslinks, has to play together with crosslinks+, above
|
|
158 \Configure{crosslinks:next}{\HCode{</div><div style="width:30\%;display:inline-block;text-align:right">}}
|
|
159 \Configure{crosslinks:up} {\HCode{</div><div style="width:40\%;display:inline-block;text-align:center">}}
|
|
160
|
|
161
|
69
|
162 %\ConfigureEnv{titlepage}
|
|
163 %{\ifvmode \IgnorePar\fi
|
|
164 % \EndP
|
|
165 % \HCode{<h1>}\IgnorePar }
|
|
166 %{\ifvmode \IgnorePar\fi
|
|
167 % \EndP \HCode{</h1>}}
|
|
168 %{}
|
|
169 %{}
|
|
170 %\ConfigureList{enumerate}
|
|
171 %{\HCode{<div>}}
|
|
172 %{\HCode{</div>}}
|
|
173 %{\HCode{<span class="mark">}}
|
|
174 %{\HCode{</span>} }
|
|
175
|
|
176 % Configure element translations.
|
|
177
|
|
178 % Sections (to include number, use \thesection)
|
70
|
179 \Configure{section} {} {} {\HCode{<h1>}} {\HCode{</h1>}}
|
|
180 \Configure{likesection} {} {} {\HCode{<h1>}} {\HCode{</h1>}}
|
|
181 \Configure{subsection} {} {} {\HCode{<h2>}} {\HCode{</h2>}}
|
|
182 \Configure{likesubsection} {} {} {\HCode{<h2>}} {\HCode{</h2>}}
|
|
183 \Configure{subsubsection} {} {} {\HCode{<h3>}} {\HCode{</h3>}}
|
|
184 \Configure{likesubsubsection} {} {} {\HCode{<h3>}} {\HCode{</h3>}}
|
0
|
185
|
|
186 %\DeclareMathSizes{12}{11}{7}{6}
|
69
|
187 %\DeclareMathSizes{10}{9}{5}{4}
|
0
|
188 %\DeclareMathSizes{11}{10}{6}{5}
|
|
189
|
69
|
190
|
70
|
191 \begin{document}
|
|
192
|
|
193 % Add here stuff that should be *in* <head>...</head>, however only for main generated page.
|
0
|
194
|
|
195 \EndPreamble
|
70
|
196
|
|
197 % vim: ft=tex
|
|
198
|