Hack to get all menus to appear in right places.

The only way I could figure out how to get different output for
monolithic and section-based versions was to do this rather odd hack,
which uses tex4ht.usr to conditionally insert specific bootstrap HTML
for the mention that will allow proper formatting.
This commit is contained in:
Bradley M. Kuhn 2014-11-07 00:50:51 -05:00
parent 988c791a78
commit 816c59aa3d
3 changed files with 38 additions and 23 deletions

View file

@ -67,12 +67,12 @@ $(HTML_OUTPUT_DIR)/monolithic/$(BOOK_BASE).html: $(LATEX_INPUT_FILES) $(WEB_CONF
mkdir -p $(HTML_OUTPUT_DIR)/monolithic/css
/bin/rm -f $(BOOK_BASE)*.html
/bin/rm -f $(BOOK_BASE)*.js
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,xhtml,mouseover,fn-in"
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,xhtml,mouseover,fn-in"
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,xhtml,mouseover,fn-in,monolith"
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,xhtml,mouseover,fn-in,monolith"
mv ${BOOK_BASE}*js $(HTML_OUTPUT_DIR)/monolithic/js
/bin/rm -f $(BOOK_BASE)*.html
/bin/rm -f $(BOOK_BASE)*.js
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,xhtml,fn-in"
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,xhtml,fn-in,monolith"
mv $(BOOK_BASE)*html $(HTML_OUTPUT_DIR)/monolithic
mv cm*png $(HTML_OUTPUT_DIR)/monolithic
mv ${BOOK_BASE}*css $(HTML_OUTPUT_DIR)/monolithic

25
tex4ht.usr Normal file
View file

@ -0,0 +1,25 @@
\newcommand{\startmymenu}{\HCode{
<footer role="contentinfo">\Hnewline
<div class="container">\Hnewline
<header class="navbar navbar-default navbar-fixed-bottom copyleft-navbar">\Hnewline
<nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation">\Hnewline
<ul class="nav navbar-nav navbar-left">\Hnewline
<li class="navbar-text">License:\Hnewline
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC By SA 4.0 International</a></li>\Hnewline}}
\newcommand{\selectmulti}{\HCode{<li class="active">HTML</li>\Hnewline
<li><a href="/guide/monolithic">HTML (single page)</li>\Hnewline}}
\newcommand{\selectmonolith}{\HCode{<li><a href="/guide/">HTML</li>\Hnewline
<li><a class="active">HTML (single page)</li>\Hnewline}}
\newcommand{\finishmymenu}{\HCode{<li><a href="/guide/comprehensive-gpl-guide.pdf">PDF</li>\Hnewline
<li><a href="/guide/comprehensive-gpl-guide.ps">Postscript</li>\Hnewline
</ul>\Hnewline}}
\:CheckOption{monolith} \if:Option
\newcommand{\monolith}{\Configure{@BODY}{\startmymenu\selectmonolith\finishmymenu\HCode{</nav></header></div></footer>}}}
\else
\newcommand{\monolith}{\Configure{next+}{\HCode{<div class="container">\Hnewline<header class="navbar navbar-default navbar-fixed-bottom copyleft-navbar">\Hnewline <p class="navbar-text navbar-left">License:\Hnewline <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC By SA 4.0 International</a></p>\Hnewline<nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation"><ul class="nav navbar-nav navbar-right">}}{\HCode{</ul></nav></header></div>}}}
\fi

View file

@ -47,28 +47,18 @@
</ul></nav></div></header>\Hnewline
}}
\monolith
\Configure{crosslinks}{\HCode{<li>}}{\HCode{</li>}}{next-section}{prev-at-top}{prev-at-bottom}{jump-to-top}{jump-to-bottom}{up-section}
\Configure{crosslinks+}
{\IgnorePar\HCode{<nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation">\Hnewline
{\startmymenu\selectmulti\finishmymenu\HCode{<nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation">\Hnewline
<ul class="nav navbar-nav navbar-center">}}
{\HCode{</ul></nav>}\par\ShowPar}
{\HCode{<div class="container">\Hnewline
<header class="navbar navbar-default navbar-fixed-bottom copyleft-navbar">\Hnewline
<p class="navbar-text navbar-left">License:\Hnewline
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC By SA 4.0 International</a></p>\Hnewline
<nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation">
<ul class="nav navbar-nav navbar-right">}\Hnewline}
{\HCode{</ul></nav></header></div>}}
\Configure{next}{next-section}
\Configure{next+}
{\HCode{<div class="container">\Hnewline
<header class="navbar navbar-default navbar-fixed-bottom copyleft-navbar">\Hnewline
<p class="navbar-text navbar-left">License:\Hnewline
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC By SA 4.0 International</a></p>\Hnewline
<nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation">
{\HCode{</ul></nav>}}
{\HCode{<nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation">\Hnewline
<ul class="nav navbar-nav navbar-right">\Hnewline}}
{\HCode{</ul></nav></header></div>}}
{\HCode{</ul></nav></header></div></footer>}}
\Tag{TITLE+}{Copyleft and the GNU General Public License: A Comprehensive Tutorial and Guide}
\EndPreamble