view doc/manual/manual_tex4ht.cfg @ 342:b55fec763864

- fix a url in doc gen
author Tassilo Philipp
date Tue, 07 Jan 2020 10:49:23 +0100
parents 5c3fa8897e0e
children 59109d1cb17b
line wrap: on
line source

%//////////////////////////////////////////////////////////////////////////////
%
% Copyright (c) 2015-2016 Tassilo Philipp <tphilipp@potion-studios.com>
%
% 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* <head>...</head>
% Use it for configurations, no actual output.

\Configure{VERSION}{}
\Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
\Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
\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.

% TITLE+ is only on main page, other use section title. Prefix everything, though.
\Configure{TITLE}{\HCode{<title>}dyncall Manual - }{\HCode{</title>}}
\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{<meta http-equiv="content-type" content="text/html; charset=utf-8"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<meta name="resource-type" content="document"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<meta name="keywords"      content="C, function, dynamic, call, calling, convention, VM, abstraction, closure"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<meta name="distribution"  content="global"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<link rel="stylesheet" id="dyn-fonts-css" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&amp;subset=latin,latin-ext" type="text/css" media="all"/>\Hnewline}}
% should this really rely on online content (dyncall's .css) even for an offline build? @@@
\Configure{@HEAD}{\HCode{<link rel="stylesheet" href="https://dyncall.org/data/main.css" type="text/css" media="all"/>\Hnewline}}

% Image path prefix can be set here...
%\Configure{IMG}
%{\ht:special{t4ht=<img src="}}
%{\ht:special{t4ht=" alt="}}
%{" }
%{\ht:special{t4ht=" }}
%{\ht:special{t4ht=/>}}

% Make TOC display as nested "ul"s.
\Configure{tableofcontents}  {}{\tocItem{0}}{}{}{}
\ConfigureToc{section}       {}{\tocItem{1}{\HCode{<li>}}}{}{}
\ConfigureToc{subsection}    {}{\tocItem{2}{\HCode{<li>}}}{}{}
\ConfigureToc{subsubsection} {}{\tocItem{3}{\HCode{<li>}}}{}{}

% Logic to open/close "ul"s correctly.
\newcount\c
\def\tocItem#1{%
	\loop
			\ifnum \c<#1
				\advance\c by 1
				\HCode{<ul>}
			\else
				\ifnum \c>#1
					\advance\c by -1
					\HCode{</li></ul>}
				\fi
				\ifnum \c=#1
					\ifnum #1>0 \HCode{</li>} \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{<table>}}
	{\HCode{</table>}}
	{\HCode{<tr>}} %{\HCode{<tr class="row-\HRow">}}
	{\HCode{</tr>}}
	{\HCode{<td \ifnum \HMultispan>1 colspan="\HMultispan"\fi >}}
	{\HCode{</td>}}

% 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{<div class='blockDiv'>}\HtmlParOff}{}{\HCode{</div>}\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<div class="ttDiv">}{\Tg</div>}{}{}
%\Configure{listings}{}{}{}{\ifnum \lstlineno>0 \Tg<br> \fi \listingLine}

% Make listing/table captions nicer.
\Configure{caption}
	{\HCode{<div class="blockCaption"><small>}}
	{\HCode{<span class="id">}}
	{\HCode{</span>: <span class="content">}}
	{\HCode{</span></small></div>}}

% All kinds of style setting for fonts, as we don't use the autogenerated
% css file, but dyncall's website one.
\Configure{texttt}{\Tg<span style="background-color:red">}{\Tg</span>}
\Configure{textrm}{\Tg<span style="background-color:red">}{\Tg</span>}
\Configure{textup}{\Tg<span style="background-color:red">}{\Tg</span>}
\Configure{textsl}{\Tg<span style="background-color:red">}{\Tg</span>}
\Configure{textsf}{\Tg<span style="background-color:red">}{\Tg</span>}
\Configure{textsc}{\Tg<span style="background-color:red">}{\Tg</span>}
\Configure{textit}{\Tg<i>}{\Tg</i>}
\Configure{textbf}{\Tg<b>}{\Tg</b>}
\Configure{emph}{\Tg<em>}{\Tg</em>}

% @@@ 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 </p> end tags, as we would end up wrapping block level
% elements like <table> in <p>...</p> pairs.
\Configure{HtmlPar}{\EndP\Tg<p>}{\EndP\Tg<p>}{\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{<div style="width:100\%;text-align:left"><div style="width:30\%;display:inline-block;text-align:left">}}%
{\HCode{</div></div><hr>}}%
{\HCode{<hr><div style="width:100\%;text-align:left"><div style="width:30\%;display:inline-block;text-align:left">}}%
{\HCode{</div></div>}}%

% Hacky - output div stuff before specific crosslinks, has to play together with crosslinks+, above
\Configure{crosslinks:next}{\HCode{</div><div style="width:30\%;display:inline-block;text-align:right">}}
\Configure{crosslinks:up}  {\HCode{</div><div style="width:40\%;display:inline-block;text-align:center">}}
 

%\ConfigureEnv{titlepage}
%{\ifvmode \IgnorePar\fi
%  \EndP
%  \HCode{<h1>}\IgnorePar }
%{\ifvmode \IgnorePar\fi
%  \EndP \HCode{</h1>}}
%{}
%{}
%\ConfigureList{enumerate}
%{\HCode{<div>}}
%{\HCode{</div>}}
%{\HCode{<span class="mark">}}
%{\HCode{</span>} }

% Configure element translations.

% Sections (to include number, use \thesection)
\Configure{section}           {} {} {\HCode{<h1>}} {\HCode{</h1>}}
\Configure{likesection}       {} {} {\HCode{<h1>}} {\HCode{</h1>}}
\Configure{subsection}        {} {} {\HCode{<h2>}} {\HCode{</h2>}}
\Configure{likesubsection}    {} {} {\HCode{<h2>}} {\HCode{</h2>}}
\Configure{subsubsection}     {} {} {\HCode{<h3>}} {\HCode{</h3>}}
\Configure{likesubsubsection} {} {} {\HCode{<h3>}} {\HCode{</h3>}}

%\DeclareMathSizes{12}{11}{7}{6}
%\DeclareMathSizes{10}{9}{5}{4}
%\DeclareMathSizes{11}{10}{6}{5}


\begin{document}

% Add here stuff that should be *in* <head>...</head>, however only for main generated page.

\EndPreamble

% vim: ft=tex