changeset 70:33c333ec5ad2

- progress on html doc generation
author cslag
date Sun, 06 Mar 2016 23:30:44 +0100
parents 43675cb378ce
children edc2afc17aa0
files doc/manual/Makefile.generic doc/manual/manual_tex4ht.cfg
diffstat 2 files changed, 108 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/doc/manual/Makefile.generic	Sun Mar 06 16:28:01 2016 +0100
+++ b/doc/manual/Makefile.generic	Sun Mar 06 23:30:44 2016 +0100
@@ -4,18 +4,28 @@
 
 manual.pdf: sources
 	# run twice for toc on some tex installs
-	cd ${VPATH} && pdflatex -output-directory=${PWD} manual.tex
-	cd ${VPATH} && pdflatex -output-directory=${PWD} manual.tex
+	cd "${VPATH}" && for i in 1 2; do pdflatex -output-directory="${PWD}" manual.tex; done
 
-manual.html: manual_tex4ht.cfg sources
+html/manual.html: manual_tex4ht.cfg sources
 	# Create tex4ht.env from default one, but with better bitmaps
-	cp $$(dirname $$(which tex4ht))/../share/texmf-dist/tex4ht/base/unix/tex4ht.env ${VPATH}/
-	cd ${VPATH} && sed -E -i '' 's/(Text|Graphics)(AlphaBits)=[1,2,3]([^0-9])/\1\2=4\3/g' tex4ht.env
-	cd ${VPATH} && htlatex manual.tex manual_tex4ht " -cunihtf"
+	cd "${VPATH}" &&  ( \
+		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/; \
+		rm ./html/*.css; \
+	)
+
+pdf: manual.pdf
+
+html:: html/manual.html
 
 clean:
 	# pdf
-	for i in pdf aux lof log lol lot out toc; do rm -f manual.$$i || true; done
+	cd "${VPATH}" && for i in pdf aux lof log lol lot out toc; do rm -f manual.$$i || true; done
 	# html
-	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 tex4ht.env; do rm -f $$i || true; done
+	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_tex4ht.cfg	Sun Mar 06 16:28:01 2016 +0100
+++ b/doc/manual/manual_tex4ht.cfg	Sun Mar 06 23:30:44 2016 +0100
@@ -1,3 +1,21 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% 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.
@@ -19,6 +37,10 @@
 \Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
 \Configure{BODY}{\HCode{<body><div class="mainDiv">\Hnewline}}{\HCode{\Hnewline</div></body>}}
 
+% 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.
 \Configure{@HEAD}{}
 \Configure{@HEAD}{\HCode{<meta http-equiv="content-type" content="text/html; charset=utf-8"/>\Hnewline}}
@@ -29,6 +51,61 @@
 % should this really rely on online content (dyncall's .css) even for an offline build? @@@
 \Configure{@HEAD}{\HCode{<link rel="stylesheet" href="http://dyncall.org/data/main.css" type="text/css" media="all"/>\Hnewline}}
 
+% 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
+}
+
+% 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
@@ -46,15 +123,23 @@
 % Configure element translations.
 
 % Sections (to include number, use \thesection)
-\Configure{section}       {} {} {\HCode{<h1>}} {\HCode{</h1>}}
-\Configure{subsection}    {} {} {\HCode{<h2>}} {\HCode{</h2>}}
-\Configure{subsubsection} {} {} {\HCode{<h3>}} {\HCode{</h3>}}
+\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} % After this comes stuff that should be *in* <head>...</head>, however only for main generated page.
+\begin{document}
+
+% Add here stuff that should be *in* <head>...</head>, however only for main generated page.
 
 \EndPreamble
+
+% vim: ft=tex
+