%//////////////////////////////////////////////////////////////////////////////
%
% Copyright (c) 2015-2016 Tassilo Philipp
%
% Permission to use, copy, modify, and distribute this software for any
% purpose with or without fee is hereby granted, provided that the above
% copyright notice and this permission notice appear in all copies.
%
% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
%
%//////////////////////////////////////////////////////////////////////////////
% Set html output type and how the pages will be organized; index=a,b,c means a
% column index, b depth partitioning per page, and if c is present and 'next',
% that next-links recurses.
% Use b=1 for outputting one big html page. b=2 would partition by sections, b=3
% by sections and subsections, and so on...
\Preamble{html,info,index=2,1,pic-tabular,pic-align,charset="utf-8",p-width}
% For manual partitioning we use b=1 above, then \CutAt
%\CutAt{subsubsection,subsection,likesubsection,section,likesection,part}
\CutAt{section}
%% Don't want TOC to be on own page.
%\ConfigureToc{likesubsubsection}{}{~}{}{ }
% Here goes stuff that should be *before* ...
% Use it for configurations, no actual output.
\Configure{VERSION}{}
\Configure{DOCTYPE}{\HCode{\Hnewline}}
\Configure{HTML}{\HCode{\Hnewline}}{\HCode{\Hnewline}}
\Configure{BODY}{\HCode{\Hnewline\Hnewline
\Hnewline}}{\HCode{\Hnewline
}} % KEEP the body on it's own line, as it's used as a marker for postprocessing.
% TITLE+ is only on main page, other use section title. Prefix everything, though.
\Configure{TITLE}{\HCode{}dyncall Manual - }{\HCode{}}
\Configure{TITLE+}{Index}
% Clear default header, define our custom one. Using @HEAD will make this be used on all pages generated.
% @@@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).
\Configure{@HEAD}{}
\Configure{@HEAD}{\HCode{\Hnewline}}
\Configure{@HEAD}{\HCode{\Hnewline}}
\Configure{@HEAD}{\HCode{\Hnewline}}
\Configure{@HEAD}{\HCode{\Hnewline}}
% should this really rely on online content (dyncall's .css) even for an offline build? @@@ also, we need a relative path here, so this complicates things further
\Configure{@HEAD}{\HCode{\Hnewline}}
% Image path prefix can be set here...
%\Configure{IMG}
%{\ht:special{t4ht=}}
% Make TOC display as nested "ul"s.
\Configure{tableofcontents} {}{\tocItem{0}}{}{}{}
\ConfigureToc{section} {}{\tocItem{1}{\HCode{
}}}{}{}
% Logic to open/close "ul"s correctly.
\newcount\c
\def\tocItem#1{%
\loop
\ifnum \c<#1
\advance\c by 1
\HCode{
}
\else
\ifnum \c>#1
\advance\c by -1
\HCode{
}
\fi
\ifnum \c=#1
\ifnum #1>0 \HCode{} \fi
\fi
\fi
\unless\ifnum \c=#1 \repeat
}
% Define layout of tables - for some reason tabular* renders fine
% when pic-tabular is *not* used. When it is, it converts tabular
% (without the asterisk) into pictures, but also changes the rendering
% of tabular*, which we then mend with the code below. Not sure if
% this is just a hack around a tex4ht bug, but it nicely lets us
% pick which table should be a picture or not.
% This means: use tabular for pictures, tabular* for text output. @@@ might want to abstract this into \htmlpic or so
\Configure{tabular}
{\HCode{
}}
{\HCode{
}}
{\HCode{
}} %{\HCode{
}}
{\HCode{
}}
{\HCode{
1 colspan="\HMultispan"\fi >}}
{\HCode{
}}
% Remove hr-tags that tex4ht inserts by default in around floats (e.g. tables) and replace them with a background.
% Also remove hr-tags around figures, entirely.
\Configure{float}[]{\HCode{
}\HtmlParOff}{}{\HCode{
}\HtmlParOn}
\ConfigureEnv{figure}{\HCode{}}{\HCode{}}{}{}
% @@@ Did not get that below to work, and don't understand it, either.
% @@@ Default output is ok, so we're simply changing class name in
% @@@ instead of this postprocessing. See Makefile.
%% Listings, so that caption below isn't in same block
%\def\listingLineReset{\newcount\lstlineno}
%\def\listingLine{\advance\lstlineno by 1}
%\ConfigureEnv{lstlisting}{\listingLineReset\Tg
}}
% All kinds of style setting for fonts, as we don't use the autogenerated
% css file, but dyncall's website one.
\Configure{texttt}{\Tg}{\Tg}
\Configure{textrm}{\Tg}{\Tg}
\Configure{textup}{\Tg}{\Tg}
\Configure{textsl}{\Tg}{\Tg}
\Configure{textsf}{\Tg}{\Tg}
\Configure{textsc}{\Tg}{\Tg}
\Configure{textit}{\Tg}{\Tg}
\Configure{textbf}{\Tg}{\Tg}
\Configure{emph}{\Tg}{\Tg}
% @@@ list of things that are still open:
% paragraph{xxx} - should probably be forced to always be on newline to reflect pdf
%\lstset{ language=C, basicstyle=\ttfamily, numbers=left,
%numberstyle=\tiny, numbersep=10pt, showstringspaces=false}
%http://www.itisnotoverengineering.com/2013/06/syntax-highlighting-with-tex4ht.html
% Simplest possible paragraphs.
% Note, we don't use the optional
end tags, as we would end up wrapping block level
% elements like
in
...
pairs.
\Configure{HtmlPar}{\EndP\Tg
}{\EndP\Tg
}{\HCode{\Hnewline}}{\HCode{\Hnewline}}
% On site navigation texts
\Configure{crosslinks}%
{}%left delimiter
{}%right delimiter
{next}%
{previous}%
{}%previous-tail
{}%front
{}%tail
{index}%up
% Which nav links to show
\Configure{crosslinks*}%
{prev}%
{up}%
{next}%
{}%
% What's around top and bottom links section
\Configure{crosslinks+}%
{\HCode{
}}%
{\HCode{
}}%
{\HCode{
}}%
{\HCode{
}}%
% Hacky - output div stuff before specific crosslinks, has to play together with crosslinks+, above
\Configure{crosslinks:next}{\HCode{
}}
%{\HCode{}}
%{\HCode{} }
% Configure element translations.
% Sections (to include number, use \thesection)
\Configure{section} {} {} {\HCode{
}} {\HCode{
}}
\Configure{likesection} {} {} {\HCode{
}} {\HCode{
}}
\Configure{subsection} {} {} {\HCode{
}} {\HCode{
}}
\Configure{likesubsection} {} {} {\HCode{
}} {\HCode{
}}
\Configure{subsubsection} {} {} {\HCode{
}} {\HCode{
}}
\Configure{likesubsubsection} {} {} {\HCode{
}} {\HCode{
}}
%\DeclareMathSizes{12}{11}{7}{6}
%\DeclareMathSizes{10}{9}{5}{4}
%\DeclareMathSizes{11}{10}{6}{5}
\begin{document}
% Add here stuff that should be *in* ..., however only for main generated page.
\EndPreamble
% vim: ft=tex