diff --git a/bin/pdf/filters/links.lua b/bin/pdf/filters/links.lua index 8866aec..58dd88c 100644 --- a/bin/pdf/filters/links.lua +++ b/bin/pdf/filters/links.lua @@ -11,7 +11,7 @@ local logging = require 'logging' local website = 'https://eth2book.info' local links, targets = {}, {} -local skip = { ["contents"] = true, ["annotated-spec"] = true } +local skip = { ["/contents/"] = true, ["/annotated-spec/"] = true } -- Check that there are no duplicate targets local function check_target(id) @@ -24,7 +24,7 @@ end -- Check that every link has a target local function check_links() for link, v in pairs(links) do - if not skip[link] and not targets[link] then + if not skip['/' .. link .. '/'] and not targets[link] then print('Links filter: link "' .. link .. '" points to nothing') end end @@ -86,7 +86,9 @@ local function update_links(block, page) -- External link t = s end - return pandoc.Link(link.content, t, link.title, link.attr) + if not skip[s] then + return pandoc.Link(link.content, t, link.title, link.attr) + end end } end diff --git a/bin/pdf/template.tex b/bin/pdf/template.tex index 52ceaf3..ac192d3 100644 --- a/bin/pdf/template.tex +++ b/bin/pdf/template.tex @@ -139,13 +139,37 @@ $endif$ \ifPDFTeX\else % xetex/luatex font selection $if(mainfont)$ - \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} + $if(mainfontfallback)$ + \ifLuaTeX + \usepackage{luaotfload} + \directlua{luaotfload.add_fallback("mainfontfallback",{ + $for(mainfontfallback)$"$mainfontfallback$"$sep$,$endfor$ + })} + \fi + $endif$ + \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$} $endif$ $if(sansfont)$ - \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} + $if(sansfontfallback)$ + \ifLuaTeX + \usepackage{luaotfload} + \directlua{luaotfload.add_fallback("sansfontfallback",{ + $for(sansfontfallback)$"$sansfontfallback$"$sep$,$endfor$ + })} + \fi + $endif$ + \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$$if(sansfontfallback)$,RawFeature={fallback=sansfontfallback}$endif$]{$sansfont$} $endif$ $if(monofont)$ - \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$} + $if(monofontfallback)$ + \ifLuaTeX + \usepackage{luaotfload} + \directlua{luaotfload.add_fallback("monofontfallback",{ + $for(monofontfallback)$"$monofontfallback$"$sep$,$endfor$ + })} + \fi + $endif$ + \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$if(monofontfallback)$,RawFeature={fallback=monofontfallback}$endif$]{$monofont$} $endif$ $for(fontfamilies)$ \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$} @@ -297,6 +321,15 @@ $-- also used for underline \usepackage[soul]{lua-ul} \else \usepackage{soul} +$if(beamer)$ + \makeatletter + \let\HL\hl + \renewcommand\hl{% fix for beamer highlighting + \let\set@color\beamerorig@set@color + \let\reset@color\beamerorig@reset@color + \HL} + \makeatother +$endif$ $if(CJKmainfont)$ \ifXeTeX % soul's \st doesn't work for CJK: @@ -380,7 +413,7 @@ $if(babel-lang)$ $if(mainfont)$ \ifPDFTeX \else -\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} +\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$} \fi $endif$ $endif$ @@ -425,7 +458,7 @@ $endif$ $if(csquotes)$ \usepackage{csquotes} $endif$ -\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} +\usepackage{bookmark} \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available \urlstyle{$if(urlstyle)$$urlstyle$$else$same$endif$} $if(links-as-notes)$