changeset 72:2b89d8497aad

- html manual work
author cslag
date Sun, 13 Mar 2016 21:08:59 +0100
parents edc2afc17aa0
children 8326c5ced916
files doc/manual/Makefile.generic doc/manual/manual.tex doc/manual/manual_overview.tex doc/manual/manual_tex4ht.cfg
diffstat 4 files changed, 90 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/doc/manual/Makefile.generic	Mon Mar 07 01:45:36 2016 +0100
+++ b/doc/manual/Makefile.generic	Sun Mar 13 21:08:59 2016 +0100
@@ -2,9 +2,24 @@
 
 sources: *.tex callconvs/*.tex dyncall_logo.* dyncall_watermark.*
 
-manual.pdf: sources
-	# run twice for toc on some tex installs
-	cd "${VPATH}" && for i in 1 2; do pdflatex -output-directory="${PWD}" manual.tex; done
+pdf: manual.pdf
+
+html:: html/manual.html
+#html-single: html/manual.html
+#html-split: html/manual.html
+
+clean:
+	# pdf
+	cd "${VPATH}" && for i in pdf aux lof log lol lot out toc; do rm -f manual.$$i || true; done
+	# html
+	cd "${VPATH}" && ( \
+		for i in 4ct 4tc css dvi html idv lg tmp xref; do rm -f manual.$$i || true; done; \
+		for i in manual*x.png manual*.html texput.log manual_*.log zzmanual.eps zzmanual.ps custom_tex4ht.env; do rm -f $$i || true; done; \
+		rm -r html || true; \
+	)
+
+
+# Main target dependencies --->
 
 manual_website_menu.html:
 	curl -s http://www.dyncall.org | sed '/<body>/,/<div class="mainDiv">/p;d' | sed 's/^.*<body>//;s/<div class="mainDiv">.*$$//' > $@
@@ -15,24 +30,16 @@
 		cp $$(dirname $$(which tex4ht))/../share/texmf-dist/tex4ht/base/unix/tex4ht.env ./custom_tex4ht.env; \
 		sed -E -i '' 's/(Text|Graphics)(AlphaBits)=[1,2,3]([^0-9])/\1\2=4\3/g' custom_tex4ht.env; \
 		mkdir -p ./html/; \
-		htlatex manual.tex manual_tex4ht " -cunihtf -e./custom_tex4ht.env -utf8" -d./html/; \
+		htlatex manual.tex manual_tex4ht " -cunihtf -e./custom_tex4ht.env -utf8" "-e./custom_tex4ht.env -d./html/"; \
 		rm ./html/*.css; \
 	)
-	# Inject menu into output html pages.
+	# Postprocessing. Inject menu into output html pages. Replace some pieces, etc..
 	for f in "${VPATH}/html/"*.html; do \
 		sed -i '' '/^<body>/r manual_website_menu.html' "$$f"; \
+		sed -E -i '' $$'s/([[:space:]]class=["\'])lstlisting(["\'])/\\1ttDiv\\2/' "$$f"; \
 	done
 
-pdf: manual.pdf
-
-html:: html/manual.html
+manual.pdf: sources
+	# run twice for toc on some tex installs
+	cd "${VPATH}" && for i in 1 2; do pdflatex -output-directory="${PWD}" manual.tex; done
 
-clean:
-	# pdf
-	cd "${VPATH}" && for i in pdf aux lof log lol lot out toc; do rm -f manual.$$i || true; done
-	# html
-	cd "${VPATH}" && ( \
-		for i in 4ct 4tc css dvi html idv lg tmp xref; do rm -f manual.$$i || true; done; \
-		for i in manual*x.png manual*.html texput.log manual_*.log zzmanual.eps zzmanual.ps custom_tex4ht.env; do rm -f $$i || true; done; \
-		rm -r html || true; \
-	)
--- a/doc/manual/manual.tex	Mon Mar 07 01:45:36 2016 +0100
+++ b/doc/manual/manual.tex	Sun Mar 13 21:08:59 2016 +0100
@@ -46,6 +46,13 @@
 		#1%
 	\fi%
 }
+\newcommand{\casehtml}[2]{%
+	\ifx\HCode\Undef%
+		#2%
+	\else%
+		#1%
+	\fi%
+}
 
 
 % Packages.
@@ -67,9 +74,7 @@
 \newcommand{\dc}{\emph{dyncall}}
 \newcommand{\capi}[1]{%
 	\noindent%
-%	\begin{verbatim}%
 		{\tt #1}%
-%	\end{verbatim}%
 }
 \newcommand{\tab}{\indent}
 
--- a/doc/manual/manual_overview.tex	Mon Mar 07 01:45:36 2016 +0100
+++ b/doc/manual/manual_overview.tex	Sun Mar 13 21:08:59 2016 +0100
@@ -22,12 +22,12 @@
 \section{Overview}
 
 The \product{dyncall} library encapsulates architecture-, OS- and compiler-specific
-function call semantics in a virtual
-
-\begin{center}
+function call semantics in a virtual %
+%
+\casehtml{\Tg<span clas="marker">}{\begin{center}}%
 \emph{bind argument parameters from left to right and then call}
-\end{center}
- 
+\casehtml{\Tg</span>}{\end{center}}%
+ %
 interface allowing programmers to call C functions 
 in a completely dynamic manner. In other words, instead of calling a function 
 directly, the \product{dyncall} library provides a mechanism to push the function parameters 
--- a/doc/manual/manual_tex4ht.cfg	Mon Mar 07 01:45:36 2016 +0100
+++ b/doc/manual/manual_tex4ht.cfg	Sun Mar 13 21:08:59 2016 +0100
@@ -21,7 +21,7 @@
 % 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,next,pic-tabular,charset="utf-8",p-width,pic-align}
+\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}
@@ -76,6 +76,59 @@
 	\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.
+\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>}}
+
+% @@@ 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}
+	{\Tg<div class="caption" style="margin-top:-1em;text-align:right;color:\#A0A0A0">}
+	{\HCode{<span class="id">}}
+	{\HCode{</span>: <span class="content">}}
+	{\HCode{</div>}}
+
+% All kinds of style setting for fonts, as we don't use the autogenerated
+% css file, but dyncall's website one.
+\Configure{texttt}{}{}
+\Configure{textit}{}{}
+\Configure{textrm}{}{}
+\Configure{textup}{}{}
+\Configure{textsl}{}{}
+\Configure{textsf}{}{}
+\Configure{textbf}{}{}
+\Configure{textsc}{}{}
+\Configure{emph}{\Tg<em>}{\Tg</em>}
+
+
+%\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
+\Configure{HtmlPar}{\EndP\Tg<p >}{\EndP\Tg<p>}{\HCode{</p>\Hnewline}}{\HCode{</p>\Hnewline}}
+
+
+
 % On site navigation texts
 \Configure{crosslinks}%
 {}%left delimiter