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