From 441df63ee7cca6d33792dbeb10b0d55eda7a4cad 2014-11-06 17:34:18 From: Bradley M. Kuhn Date: 2014-11-06 17:34:18 Subject: [PATCH] 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. --- diff --git a/Makefile b/Makefile index 537405dd6517fe602348f1ca13ab9ec2eef53914..b161bdecd7634a5ecec6b563e3487941490be44a 100644 --- a/Makefile +++ b/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) diff --git a/README.md b/README.md index bda4ce7c10503a82dfd41c4ff80b187d25fbf408..329e5a320e53db4304fbef19de0cdd5134a5dfb9 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/TODO.md b/TODO.md index ed429b415e715b6128ff3a64b7d204b03727e170..7dfd67f1911bd6c9a648b1692be34104d851283d 100644 --- a/TODO.md +++ b/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. diff --git a/comprehensive-gpl-guide.tex b/comprehensive-gpl-guide.tex index d2aacb5d567cd3433dce652ffb19354d965830b4..78f118d49845cc3a4e0de993d942982b1d4b826c 100644 --- a/comprehensive-gpl-guide.tex +++ b/comprehensive-gpl-guide.tex @@ -24,6 +24,7 @@ %\input{no-numbers-on-table-of-contents} \begin{document} + \pagestyle{plain} \pagenumbering{roman} diff --git a/css/footnote-hack.css b/css/footnote-hack.css new file mode 100644 index 0000000000000000000000000000000000000000..eebf114af3fa086f640da2ad9610a3bd79425efe --- /dev/null +++ b/css/footnote-hack.css @@ -0,0 +1,46 @@ +/* Released as CC0: http://creativecommons.org/publicdomain/zero/1.0/ */ +/* by Bradley M. Kuhn */ + +.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; +} diff --git a/js/tex4ht-footnote-hack.js b/js/tex4ht-footnote-hack.js new file mode 100644 index 0000000000000000000000000000000000000000..872b534a241372be18e3f4e334436e9ea357ab71 --- /dev/null +++ b/js/tex4ht-footnote-hack.js @@ -0,0 +1,33 @@ +// Released as CC0: http://creativecommons.org/publicdomain/zero/1.0/ +// by Bradley M. Kuhn + +$(function() { +$( ".footnote-mark" ).tooltip({ + items: "a", + hide: { duration: 5000 }, + position: { + my: "center bottom-20", + at: "center left", + using: function( position, feedback ) { + $( this ).css( position ); + $( "
" ) + .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"; +// }});}); diff --git a/webhacks.cfg b/webhacks.cfg new file mode 100644 index 0000000000000000000000000000000000000000..692a8ac4d8aa939d7d7a2a48a92e0e43e4e8577a --- /dev/null +++ b/webhacks.cfg @@ -0,0 +1,8 @@ +\Preamble{xhtml} +\begin{document} +\Configure{@HEAD}{\HCode{ \Hnewline}} + \Configure{@HEAD}{\HCode{\Hnewline}} + \Configure{@HEAD}{\HCode{\Hnewline}} + \Configure{@HEAD}{\HCode{\Hnewline}} + \Configure{@HEAD}{\HCode{\Hnewline}} +\EndPreamble