Hack tex4ht's overlib stuff to use jQuery tooltip
tex4ht supports "overlib" for footnote popups. The hack is pretty straightforward; it dumps a Javascript area into a .js file that can then be used by overlib to popup stuff. This hack is to use that output to make the same thing work with jQuery UI's tooltip widget. Note that we run with overlib support first, then *without* it in the Makefile setup. This is to force the needed .js file to be generated, but make sure the HTML doesn't try to load overlib (which is default). (This should be adapted as a patch to upstream tex4ht ultimately.) Also included herein are improvements to the Makefile to build the HTML output.
This commit is contained in:
parent
87a9a059d4
commit
441df63ee7
7 changed files with 137 additions and 12 deletions
53
Makefile
53
Makefile
|
@ -7,18 +7,25 @@ endif
|
|||
LATEX_INPUT_FILES = $(BOOK_BASE).tex compliance-guide.tex license-texts.tex enforcement-case-studies.tex gpl-lgpl.tex
|
||||
BOOK_CLASS_FILE = gpl-book.cls
|
||||
|
||||
HTML_OUTPUT_DIR = public_html
|
||||
|
||||
TEX4HT=tex4ht
|
||||
T4HT=t4ht
|
||||
HTLATEX=htlatex
|
||||
PDFLATEX = pdflatex
|
||||
LATEX = latex
|
||||
BIBTEX = bibtex
|
||||
FIG2DEV = fig2dev
|
||||
DVIPS=dvips
|
||||
|
||||
all: err $(BOOK_BASE).pdf $(BOOK_BASE).ps $(BOOK_BASE).html
|
||||
all: err $(BOOK_BASE).pdf $(BOOK_BASE).ps html
|
||||
|
||||
pdf: err $(BOOK_BASE).pdf
|
||||
|
||||
html: $(HTML_OUTPUT_DIR)/monolithic/$(BOOK_BASE).html $(HTML_OUTPUT_DIR)/$(BOOK_BASE).html pdf $(BOOK_BASE).ps
|
||||
/bin/ln -f $(BOOK_BASE).ps $(HTML_OUTPUT_DIR)/$(BOOK_BASE).ps
|
||||
/bin/ln -f $(BOOK_BASE).pdf $(HTML_OUTPUT_DIR)/$(BOOK_BASE).pdf
|
||||
|
||||
.SUFFIXES: .fig .postscript .eps .pdf .pstex_t .pstex .ps .dvi .tex
|
||||
|
||||
.postscript.pdf:
|
||||
|
@ -45,20 +52,46 @@ pdf: err $(BOOK_BASE).pdf
|
|||
$(BOOK_BASE).pdf: $(PDF_FIGS) $(LATEX_INPUT_FILES) $(BOOK_CLASS_FILE)
|
||||
$(PDFLATEX) $(BOOK_BASE)
|
||||
$(PDFLATEX) $(BOOK_BASE)
|
||||
$(PDFLATEX) $(BOOK_BASE)
|
||||
|
||||
$(BOOK_BASE).html: $(LATEX_INPUT_FILES) $(BOOK_CLASS_FILE)
|
||||
echo "building HTML"
|
||||
$(LATEX) '\def\generateHTML{\hfill}' '\input' $(BOOK_BASE).tex
|
||||
$(LATEX) '\def\generateHTML{\hfill}' '\input' $(BOOK_BASE).tex
|
||||
$(TEX4HT) -f/$(BOOK_BASE).tex -i/$(BOOK_TEX_PATH)
|
||||
$(T4HT) -f/$(BOOK_BASE).tex
|
||||
rm $(BOOK_BASE).dvi
|
||||
$(HTML_OUTPUT_DIR)/monolithic/$(BOOK_BASE).html: $(LATEX_INPUT_FILES) $(BOOK_CLASS_FILE)
|
||||
mkdir -p $(HTML_OUTPUT_DIR)/monolithic/js
|
||||
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"
|
||||
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,xhtml,mouseover"
|
||||
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"
|
||||
mv $(BOOK_BASE)*html $(HTML_OUTPUT_DIR)/monolithic
|
||||
mv cm*png $(HTML_OUTPUT_DIR)/monolithic
|
||||
mv ${BOOK_BASE}*css $(HTML_OUTPUT_DIR)/monolithic
|
||||
cp -pa js/*js $(HTML_OUTPUT_DIR)/monolithic/js
|
||||
cp -pa css/*css $(HTML_OUTPUT_DIR)/monolithic/css
|
||||
|
||||
$(HTML_OUTPUT_DIR)/$(BOOK_BASE).html: $(LATEX_INPUT_FILES) $(BOOK_CLASS_FILE)
|
||||
mkdir -p $(HTML_OUTPUT_DIR)/js
|
||||
mkdir -p $(HTML_OUTPUT_DIR)/css
|
||||
/bin/rm -f $(BOOK_BASE)*.html
|
||||
/bin/rm -f $(BOOK_BASE)*.js
|
||||
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,xhtml,3,next,mouseover"
|
||||
mv ${BOOK_BASE}*js $(HTML_OUTPUT_DIR)/js
|
||||
/bin/rm -f $(BOOK_BASE)*.html
|
||||
/bin/rm -f $(BOOK_BASE)*.js
|
||||
$(HTLATEX) comprehensive-gpl-guide.tex "webhacks,3,next,webhacks"
|
||||
mv ${BOOK_BASE}*css $(HTML_OUTPUT_DIR)
|
||||
mv ${BOOK_BASE}*html $(HTML_OUTPUT_DIR)
|
||||
mv cm*png $(HTML_OUTPUT_DIR)
|
||||
cp -pa js/*js $(HTML_OUTPUT_DIR)/js
|
||||
cp -pa css/*css $(HTML_OUTPUT_DIR)/css
|
||||
|
||||
$(BOOK_BASE).dvi: $(LATEX_INPUT_FILES) $(EPS_FIGS) ${BOOK_CLASS_FILE}
|
||||
$(LATEX) $(BOOK_BASE).tex
|
||||
$(LATEX) $(BOOK_BASE).tex
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(BOOK_BASE).ps $(BOOK_BASE).pdf $(BOOK_BASE).log texput.log $(BOOK_BASE).lg $(BOOK_BASE).tmp $(BOOK_BASE).xref *.4ct *.4tc *.aux *.dvi $(BOOK_BASE)*.html *.idv *.lg *.tmp $(BOOK_BASE).css $(BOOK_BASE).log $(BOOK_BASE).out $(BOOK_BASE)-js.*
|
||||
|
||||
/bin/rm -f $(BOOK_BASE).ps $(BOOK_BASE).pdf $(BOOK_BASE).log texput.log $(BOOK_BASE).lg $(BOOK_BASE).tmp $(BOOK_BASE).xref *.4ct *.4tc *.aux *.dvi $(BOOK_BASE)*.html *.idv *.lg *.tmp $(BOOK_BASE).css $(BOOK_BASE).log $(BOOK_BASE).out $(BOOK_BASE)-js.* cm*png
|
||||
/bin/rm -rf public_html
|
||||
err: ; $(ERR)
|
||||
|
|
|
@ -6,9 +6,11 @@ Public Licenses and copyleft (as applied to software).
|
|||
The primary item of interest is an omnibus book on copyleft that is built
|
||||
from the comprehensive-GPL-guide.tex file.
|
||||
|
||||
You can likely build a PDF file from:
|
||||
You can build this project with the following command:
|
||||
|
||||
$ pdflatex comprehensive-gpl-guide.tex && pdflatex comprehensive-gpl-guide.tex && pdflatex comprehensive-gpl-guide.tex
|
||||
$ make
|
||||
|
||||
HTML output will be in the public_html directory and a PDF file will be in comprehensive-gpl-guide.pdf.
|
||||
|
||||
You can also [download a prebuilt PDF file](http://ebb.org/bkuhn/articles/copyleft-book.pdf).
|
||||
|
||||
|
|
2
TODO.md
2
TODO.md
|
@ -1,3 +1,5 @@
|
|||
# TODOS
|
||||
|
||||
* Document [creating an EPUB](http://tex.stackexchange.com/questions/1551/use-latex-to-produce-epub)
|
||||
* Adapt the jQuery UI tooltip hack used for the overlib replacement with
|
||||
tex4ht to upstream tex4ht.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
%\input{no-numbers-on-table-of-contents}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\pagestyle{plain}
|
||||
\pagenumbering{roman}
|
||||
|
||||
|
|
46
css/footnote-hack.css
Normal file
46
css/footnote-hack.css
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* Released as CC0: http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* by Bradley M. Kuhn <bkuhn@ebb.org> */
|
||||
|
||||
.ui-tooltip, .arrow:after {
|
||||
background: black;
|
||||
border: 2px solid white;
|
||||
}
|
||||
.ui-tooltip {
|
||||
padding: 10px 20px;
|
||||
color: white;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 0 7px black;
|
||||
max-width: 50%;
|
||||
}
|
||||
.arrow {
|
||||
width: 70px;
|
||||
height: 16px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-left: -35px;
|
||||
bottom: -16px;
|
||||
}
|
||||
.arrow.top {
|
||||
top: -16px;
|
||||
bottom: auto;
|
||||
}
|
||||
.arrow.left {
|
||||
left: 20%;
|
||||
}
|
||||
.arrow:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 20px;
|
||||
top: -20px;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
box-shadow: 6px 5px 9px -9px black;
|
||||
-webkit-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.arrow.top:after {
|
||||
bottom: -20px;
|
||||
top: auto;
|
||||
}
|
33
js/tex4ht-footnote-hack.js
Normal file
33
js/tex4ht-footnote-hack.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Released as CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
// by Bradley M. Kuhn <bkuhn@ebb.org>
|
||||
|
||||
$(function() {
|
||||
$( ".footnote-mark" ).tooltip({
|
||||
items: "a",
|
||||
hide: { duration: 5000 },
|
||||
position: {
|
||||
my: "center bottom-20",
|
||||
at: "center left",
|
||||
using: function( position, feedback ) {
|
||||
$( this ).css( position );
|
||||
$( "<div>" )
|
||||
.addClass( "arrow" )
|
||||
.addClass( feedback.vertical )
|
||||
.addClass( feedback.horizontal )
|
||||
.appendTo( this );
|
||||
}
|
||||
},
|
||||
content: function() {
|
||||
var element = $( this );
|
||||
if ( element.is( 'a' ) ) {
|
||||
var footnoteVal = element.attr( "href" );
|
||||
return tex4ht[footnoteVal.substring(footnoteVal.search("#") + 1)];
|
||||
}
|
||||
}});
|
||||
});
|
||||
// $(function() {
|
||||
// $( document ).tooltip({
|
||||
// content: function() {
|
||||
// var element = $( this );
|
||||
// return "HI";
|
||||
// }});});
|
8
webhacks.cfg
Normal file
8
webhacks.cfg
Normal file
|
@ -0,0 +1,8 @@
|
|||
\Preamble{xhtml}
|
||||
\begin{document}
|
||||
\Configure{@HEAD}{\HCode{<link rel="stylesheet" type="text/css" href="css/footnote-hack.css" /> \Hnewline}}
|
||||
\Configure{@HEAD}{\HCode{<script type="text/javascript" src="http://copyleft.org/jquery-1.10.2.js"></script>\Hnewline}}
|
||||
\Configure{@HEAD}{\HCode{<script type="text/javascript" src="http://copyleft.org/jquery-ui-1.11.2.js"></script>\Hnewline}}
|
||||
\Configure{@HEAD}{\HCode{<script type="text/javascript" src="js/comprehensive-gpl-guide-js.js"></script>\Hnewline}}
|
||||
\Configure{@HEAD}{\HCode{<script type="text/javascript" src="js/tex4ht-footnote-hack.js"></script>\Hnewline}}
|
||||
\EndPreamble
|
Loading…
Reference in a new issue