diff --git a/.gitignore b/.gitignore index 2d7777f3..0967dd49 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,7 @@ Gemfile.lock ## Emacs files auto/ + +## Misc build files +out/ +src/plfa/acknowledgements_epub.md diff --git a/.travis.yml b/.travis.yml index 7269268f..97b07520 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ addons: packages: - libgmp-dev - libicu-dev + - luarocks # Ensure we run BASH and not SH env: diff --git a/Makefile b/Makefile index 88c544fd..9eb27434 100644 --- a/Makefile +++ b/Makefile @@ -49,12 +49,10 @@ out/: # sections are displayed to users. Some readers may be slow if the chapter # files are too large, so for large documents with few level-1 headings, one # might want to use a chapter level of 2 or 3." -# -#TODO: embedded fonts not working (path problem?) epub: out/plfa.epub -out/plfa.epub: out/ $(AGDA) $(LUA) epub/main.css +out/plfa.epub: out/ $(AGDA) $(LUA) epub/main.css src/plfa/acknowledgements_epub.md pandoc --strip-comments \ --css=epub/main.css \ --epub-embed-font='assets/fonts/mononoki.woff' \ @@ -62,6 +60,7 @@ out/plfa.epub: out/ $(AGDA) $(LUA) epub/main.css --epub-embed-font='assets/fonts/DejaVuSansMono.woff' \ --lua-filter epub/include-files.lua \ --lua-filter epub/rewrite-links.lua \ + --lua-filter epub/rewrite-html-ul.lua \ --lua-filter epub/default-code-class.lua -M default-code-class=agda \ --standalone \ --fail-if-warnings \ @@ -70,7 +69,8 @@ out/plfa.epub: out/ $(AGDA) $(LUA) epub/main.css -o "$@" \ epub/index.md - +src/plfa/acknowledgements_epub.md: src/plfa/acknowledgements.md _config.yml + lua epub/run-liquid.lua _config.yml $< > $@ # Convert literal Agda to Markdown @@ -119,7 +119,7 @@ build-incremental: $(MARKDOWN) # Remove all auxiliary files clean: - rm -f .agda-stdlib.sed .links-*.sed + rm -f .agda-stdlib.sed .links-*.sed src/plfa/acknowledgements_epub.md ifneq ($(strip $(AGDAI)),) rm $(AGDAI) endif @@ -158,6 +158,9 @@ travis-setup:\ $(HOME)/agda-stdlib-$(AGDA_STDLIB_VERSION)/src\ $(HOME)/.agda/defaults\ $(HOME)/.agda/libraries\ + $(HOME)/.local/share/lua/5.1/tinyyaml.lua\ + $(HOME)/.local/share/lua/5.1/liquid.lua\ + $(HOME)/.local/share/lua/5.1/cjson\ /usr/bin/pandoc .phony: travis-setup @@ -204,6 +207,17 @@ $(HOME)/.local/bin/agda: cd $(HOME)/agda-$(AGDA_VERSION);\ stack install --stack-yaml=stack-8.0.2.yaml +$(HOME)/.local/share/lua/5.1/tinyyaml.lua: + luarocks install lua-tinyyaml + +$(HOME)/.local/share/lua/5.1/liquid.lua: + luarocks install liquid + +$(HOME)/.local/share/lua/5.1/cjson: + # Only this particular version works: + # https://github.com/mpx/lua-cjson/issues/56: + luarocks install lua-cjson 2.1.0-1 + travis-uninstall-agda: rm -rf $(HOME)/agda-$(AGDA_VERSION)/ rm -f $(HOME)/.local/bin/agda diff --git a/epub/index.md b/epub/index.md index 1124e8d0..c6f8bf89 100644 --- a/epub/index.md +++ b/epub/index.md @@ -65,7 +65,7 @@ src/plfa/part2/Substitution.lagda.md # Backmatter ``` {.include shift-heading-level-by=1} -src/plfa/acknowledgements.md +src/plfa/acknowledgements_epub.md src/plfa/Fonts.lagda.md src/plfa/statistics.md ``` diff --git a/epub/rewrite-html-ul.lua b/epub/rewrite-html-ul.lua new file mode 100644 index 00000000..5a83375a --- /dev/null +++ b/epub/rewrite-html-ul.lua @@ -0,0 +1,5 @@ +-- Transforms '