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.
|
82
|
45 % @@@Ideally, this wouldn't be a copy&paste of the website's header, here. Such thing should be done in the website build, and this here a generic header (however, style is kinda needed).
|
0
|
46 \Configure{@HEAD}{}
|
|
47 \Configure{@HEAD}{\HCode{<meta http-equiv="content-type" content="text/html; charset=utf-8"/>\Hnewline}}
|
|
48 \Configure{@HEAD}{\HCode{<meta name="resource-type" content="document"/>\Hnewline}}
|
|
49 \Configure{@HEAD}{\HCode{<meta name="keywords" content="C, function, dynamic, call, calling, convention, VM, abstraction, closure"/>\Hnewline}}
|
|
50 \Configure{@HEAD}{\HCode{<meta name="distribution" content="global"/>\Hnewline}}
|
|
51 \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}}
|
|
52 % should this really rely on online content (dyncall's .css) even for an offline build? @@@
|
|
53 \Configure{@HEAD}{\HCode{<link rel="stylesheet" href="http://dyncall.org/data/main.css" type="text/css" media="all"/>\Hnewline}}
|
69
|
54
|
76
|
55 % Image path prefix can be set here...
|
|
56 %\Configure{IMG}
|
|
57 %{\ht:special{t4ht=<img src="}}
|
|
58 %{\ht:special{t4ht=" alt="}}
|
|
59 %{" }
|
|
60 %{\ht:special{t4ht=" }}
|
|
61 %{\ht:special{t4ht=/>}}
|
|
62
|
70
|
63 % Make TOC display as nested "ul"s.
|
|
64 \Configure{tableofcontents} {}{\tocItem{0}}{}{}{}
|
|
65 \ConfigureToc{section} {}{\tocItem{1}{\HCode{<li>}}}{}{}
|
|
66 \ConfigureToc{subsection} {}{\tocItem{2}{\HCode{<li>}}}{}{}
|
|
67 \ConfigureToc{subsubsection} {}{\tocItem{3}{\HCode{<li>}}}{}{}
|
|
68
|
|
69 % Logic to open/close "ul"s correctly.
|
|
70 \newcount\c
|
|
71 \def\tocItem#1{%
|
|
72 \loop
|
|
73 \ifnum \c<#1
|
|
74 \advance\c by 1
|
|
75 \HCode{<ul>}
|
|
76 \else
|
|
77 \ifnum \c>#1
|
|
78 \advance\c by -1
|
|
79 \HCode{</li></ul>}
|
|
80 \fi
|
|
81 \ifnum \c=#1
|
|
82 \ifnum #1>0 \HCode{</li>} \fi
|
|
83 \fi
|
|
84 \fi
|
|
85 \unless\ifnum \c=#1 \repeat
|
|
86 }
|
|
87
|
72
|
88 % Define layout of tables - for some reason tabular* renders fine
|
|
89 % when pic-tabular is *not* used. When it is, it converts tabular
|
|
90 % (without the asterisk) into pictures, but also changes the rendering
|
|
91 % of tabular*, which we then mend with the code below. Not sure if
|
|
92 % this is just a hack around a tex4ht bug, but it nicely lets us
|
|
93 % pick which table should be a picture or not.
|
76
|
94 % This means: use tabular for pictures, tabular* for text output. @@@ might want to abstract this into \htmlpic or so
|
72
|
95 \Configure{tabular}
|
|
96 {\HCode{<table>}}
|
|
97 {\HCode{</table>}}
|
|
98 {\HCode{<tr>}} %{\HCode{<tr class="row-\HRow">}}
|
|
99 {\HCode{</tr>}}
|
|
100 {\HCode{<td \ifnum \HMultispan>1 colspan="\HMultispan"\fi >}}
|
|
101 {\HCode{</td>}}
|
|
102
|
90
|
103 % Remove hr-tags that tex4ht inserts by default in around floats (e.g. tables) and replace them with a background.
|
|
104 % Also remove hr-tags around figures, entirely.
|
|
105 \Configure{float}[]{\HCode{<div style="margin:1em;padding:0.5em;background:rgba(200,200,200,0.1);width:100\%;">}}{}{\HCode{</div>}}
|
|
106 \ConfigureEnv{figure}{\HCode{}}{\HCode{}}{}{}
|
|
107
|
|
108 %% Simplest possible table layout - do rest in css.
|
|
109 %\Configure{HBorder}
|
|
110 % {<tr>}
|
|
111 % {}
|
|
112 % {</tr>}
|
|
113 % {<tr>}
|
|
114 % {}
|
|
115 % {}
|
|
116 % {</tr>}
|
|
117 % {<tr>}
|
|
118 % {}
|
|
119 % {</tr>}
|
|
120
|
72
|
121 % @@@ Did not get that below to work, and don't understand it, either.
|
|
122 % @@@ Default output is ok, so we're simply changing class name in
|
|
123 % @@@ instead of this postprocessing. See Makefile.
|
|
124 %% Listings, so that caption below isn't in same block
|
|
125 %\def\listingLineReset{\newcount\lstlineno}
|
|
126 %\def\listingLine{\advance\lstlineno by 1}
|
|
127 %\ConfigureEnv{lstlisting}{\listingLineReset\Tg<div class="ttDiv">}{\Tg</div>}{}{}
|
|
128 %\Configure{listings}{}{}{}{\ifnum \lstlineno>0 \Tg<br> \fi \listingLine}
|
|
129
|
73
|
130 % Make listing/table captions nicer. NOTE: the -0.5em might need to be adapted if the main css changes.@@@
|
72
|
131 \Configure{caption}
|
73
|
132 {\HCode{<div class="caption" style="margin:-0.5em 0;text-align:right;color:\#A0A0A0"><small>}}
|
72
|
133 {\HCode{<span class="id">}}
|
|
134 {\HCode{</span>: <span class="content">}}
|
73
|
135 {\HCode{</span></small></div>}}
|
72
|
136
|
|
137 % All kinds of style setting for fonts, as we don't use the autogenerated
|
|
138 % css file, but dyncall's website one.
|
73
|
139 \Configure{texttt}{\Tg<span style="background-color:red">}{\Tg</span>}
|
|
140 \Configure{textrm}{\Tg<span style="background-color:red">}{\Tg</span>}
|
|
141 \Configure{textup}{\Tg<span style="background-color:red">}{\Tg</span>}
|
|
142 \Configure{textsl}{\Tg<span style="background-color:red">}{\Tg</span>}
|
|
143 \Configure{textsf}{\Tg<span style="background-color:red">}{\Tg</span>}
|
|
144 \Configure{textsc}{\Tg<span style="background-color:red">}{\Tg</span>}
|
|
145 \Configure{textit}{\Tg<i>}{\Tg</i>}
|
|
146 \Configure{textbf}{\Tg<b>}{\Tg</b>}
|
72
|
147 \Configure{emph}{\Tg<em>}{\Tg</em>}
|
|
148
|
76
|
149 % @@@ list of things that are still open:
|
|
150 % paragraph{xxx} - should probably be forced to always be on newline to reflect pdf
|
72
|
151
|
|
152 %\lstset{ language=C, basicstyle=\ttfamily, numbers=left,
|
|
153 %numberstyle=\tiny, numbersep=10pt, showstringspaces=false}
|
|
154
|
|
155 %http://www.itisnotoverengineering.com/2013/06/syntax-highlighting-with-tex4ht.html
|
|
156
|
|
157 % Simplest possible paragraphs
|
90
|
158 % @@@ this creates paragraphs around block level elements, which is not what we would like
|
|
159 % @@@ but it looks decent, except for the space in the float-element lr-corner
|
|
160 \Configure{HtmlPar}{\EndP\Tg<p>}{\EndP\Tg<p>}{\HCode{</p>\Hnewline}}{\HCode{</p>\Hnewline}}
|
|
161 %\Configure{HtmlPar}{\EndP\HCode{}}{\EndP\HCode{}}{\HCode{\Hnewline}}{\HCode{\Hnewline}}
|
|
162 %\Configure{HtmlPar}{\EndP\Tg<p>}{\EndP\HCode{}}{\HCode{</p>\Hnewline}}{\HCode{\Hnewline}}
|
|
163 %\Configure{HtmlPar}{\EndP\HCode{}}{\EndP\Tg<p>}{\HCode{\Hnewline}}{\HCode{</p>\Hnewline}}
|
72
|
164
|
|
165
|
|
166
|
70
|
167 % On site navigation texts
|
|
168 \Configure{crosslinks}%
|
|
169 {}%left delimiter
|
|
170 {}%right delimiter
|
|
171 {next}%
|
|
172 {previous}%
|
|
173 {}%previous-tail
|
|
174 {}%front
|
|
175 {}%tail
|
|
176 {index}%up
|
|
177
|
|
178 % Which nav links to show
|
|
179 \Configure{crosslinks*}%
|
|
180 {prev}%
|
|
181 {up}%
|
|
182 {next}%
|
|
183 {}%
|
|
184
|
|
185 % What's around top and bottom links section
|
|
186 \Configure{crosslinks+}%
|
|
187 {\HCode{<div style="width:100\%;text-align:left"><div style="width:30\%;display:inline-block;text-align:left">}}%
|
|
188 {\HCode{</div></div><hr>}}%
|
|
189 {\HCode{<hr><div style="width:100\%;text-align:left"><div style="width:30\%;display:inline-block;text-align:left">}}%
|
|
190 {\HCode{</div></div>}}%
|
|
191
|
|
192 % Hacky - output div stuff before specific crosslinks, has to play together with crosslinks+, above
|
|
193 \Configure{crosslinks:next}{\HCode{</div><div style="width:30\%;display:inline-block;text-align:right">}}
|
|
194 \Configure{crosslinks:up} {\HCode{</div><div style="width:40\%;display:inline-block;text-align:center">}}
|
|
195
|
|
196
|
69
|
197 %\ConfigureEnv{titlepage}
|
|
198 %{\ifvmode \IgnorePar\fi
|
|
199 % \EndP
|
|
200 % \HCode{<h1>}\IgnorePar }
|
|
201 %{\ifvmode \IgnorePar\fi
|
|
202 % \EndP \HCode{</h1>}}
|
|
203 %{}
|
|
204 %{}
|
|
205 %\ConfigureList{enumerate}
|
|
206 %{\HCode{<div>}}
|
|
207 %{\HCode{</div>}}
|
|
208 %{\HCode{<span class="mark">}}
|
|
209 %{\HCode{</span>} }
|
|
210
|
|
211 % Configure element translations.
|
|
212
|
|
213 % Sections (to include number, use \thesection)
|
70
|
214 \Configure{section} {} {} {\HCode{<h1>}} {\HCode{</h1>}}
|
|
215 \Configure{likesection} {} {} {\HCode{<h1>}} {\HCode{</h1>}}
|
|
216 \Configure{subsection} {} {} {\HCode{<h2>}} {\HCode{</h2>}}
|
|
217 \Configure{likesubsection} {} {} {\HCode{<h2>}} {\HCode{</h2>}}
|
|
218 \Configure{subsubsection} {} {} {\HCode{<h3>}} {\HCode{</h3>}}
|
|
219 \Configure{likesubsubsection} {} {} {\HCode{<h3>}} {\HCode{</h3>}}
|
0
|
220
|
|
221 %\DeclareMathSizes{12}{11}{7}{6}
|
69
|
222 %\DeclareMathSizes{10}{9}{5}{4}
|
0
|
223 %\DeclareMathSizes{11}{10}{6}{5}
|
|
224
|
69
|
225
|
70
|
226 \begin{document}
|
|
227
|
|
228 % Add here stuff that should be *in* <head>...</head>, however only for main generated page.
|
0
|
229
|
|
230 \EndPreamble
|
70
|
231
|
|
232 % vim: ft=tex
|
|
233
|