summaryrefslogtreecommitdiff
path: root/_extensions
diff options
context:
space:
mode:
Diffstat (limited to '_extensions')
-rw-r--r--_extensions/js/ingress/_extension.yml6
-rw-r--r--_extensions/js/ingress/ingress.lua29
-rw-r--r--_extensions/js/stylish-issue/_extension.yaml17
-rw-r--r--_extensions/js/stylish-issue/doc-class.tex68
4 files changed, 120 insertions, 0 deletions
diff --git a/_extensions/js/ingress/_extension.yml b/_extensions/js/ingress/_extension.yml
new file mode 100644
index 0000000..4655adc
--- /dev/null
+++ b/_extensions/js/ingress/_extension.yml
@@ -0,0 +1,6 @@
+title: Ingress
+author: Jonas Smedegaard
+version: 0.0.1
+contributes:
+ filters:
+ - ingress.lua
diff --git a/_extensions/js/ingress/ingress.lua b/_extensions/js/ingress/ingress.lua
new file mode 100644
index 0000000..3c2c429
--- /dev/null
+++ b/_extensions/js/ingress/ingress.lua
@@ -0,0 +1,29 @@
+-- Translate div class .lead to custo LaTeX environment \ingress{}
+
+local function escape_latex(str)
+ local replacements = {
+ ["\\"] = "\\textbackslash{}",
+ ["{"] = "\\{",
+ ["}"] = "\\}",
+ ["$"] = "\\$",
+ ["&"] = "\\&",
+ ["#"] = "\\#",
+ ["_"] = "\\_",
+ ["%"] = "\\%",
+ ["^"] = "\\textasciicircum{}",
+ ["~"] = "\\textasciitilde{}"
+ }
+ return (str:gsub(".", function(c)
+ return replacements[c] or c
+ end))
+end
+
+function Div(el)
+ if FORMAT:match 'latex' then
+ if el.classes:includes('lead') then
+ local content = pandoc.utils.stringify(el.content)
+ local escaped_content = escape_latex(content)
+ return pandoc.RawBlock('latex', '\\ingress{' .. escaped_content .. '}')
+ end
+ end
+end
diff --git a/_extensions/js/stylish-issue/_extension.yaml b/_extensions/js/stylish-issue/_extension.yaml
index 0af14b6..0f3aeac 100644
--- a/_extensions/js/stylish-issue/_extension.yaml
+++ b/_extensions/js/stylish-issue/_extension.yaml
@@ -18,6 +18,7 @@ contributes:
template-partials:
- before-title.tex
+ - doc-class.tex
include-in-header:
# borrow microtype tunings from somewhat similar EB Garamond
@@ -83,3 +84,19 @@ contributes:
}
}
\makeatother
+# define format for ingress text
+ - text: |
+ \makeatletter
+ \newcommand{\ingress}[1]{%
+ {\Large #1}\par
+ \@afterindentfalse
+ \@afterheading
+ \vspace{.5\baselineskip}%
+ }
+ \makeatother
+# refine hyphenation
+ - text: |
+ \hyphenation{
+ skulp-tur skulp-tur-en skulp-tur-ens
+ skulp-tur-er skulp-tur-ers
+ skulp-tur-er-ne skulp-tur-er-nes}
diff --git a/_extensions/js/stylish-issue/doc-class.tex b/_extensions/js/stylish-issue/doc-class.tex
new file mode 100644
index 0000000..a9dbfaa
--- /dev/null
+++ b/_extensions/js/stylish-issue/doc-class.tex
@@ -0,0 +1,68 @@
+\DocumentMetadata{
+% modern PDF rendering: <https://tex.stackexchange.com/a/686905/309738>
+$if(lang)$
+ lang={$lang$},
+$endif$
+$if(pdfversion)$
+ pdfversion=$pdfversion$,
+$endif$
+$for(pdfstandard)$
+ pdfstandard=$pdfstandard$,
+$endfor$
+$if(pdftestphase)$
+testphase=
+ {
+$for(pdftestphase)$
+ $pdftestphase$,
+$endfor$
+ },
+$endif$
+$if(pdfdebug)$
+debug=
+ {
+$for(pdfdebug)$
+ $pdfdebug$,
+$endfor$
+ },
+$endif$
+$if(pdfdebugfirstaidoff)$
+debug=
+ {
+firstaidoff=
+ {
+$for(pdfdebugfirstaidoff)$
+ $pdfdebugfirstaidoff$,
+$endfor$
+ },
+ },
+$endif$
+}
+$if(copyright)$
+% flag as rights protected <https://tex.stackexchange.com/a/712443/309738>
+\ExplSyntaxOn
+\pdfmeta_xmp_add:n{<xmpRights:Marked>True</xmpRights:Marked>}
+\ExplSyntaxOff
+$endif$
+$if(pdftestphasestrict)$
+% fatalize tagging warnings
+\ExplSyntaxOn
+ \msg_redirect_module:nnn { tag } { warning } { error }
+\ExplSyntaxOff
+$endif$
+\documentclass[
+$for(babel-otherlangs)$
+ $babel-otherlangs$,
+$endfor$
+$if(babel-lang)$
+ $babel-lang$,
+$endif$
+$if(fontsize)$
+ $fontsize$,
+$endif$
+$if(papersize)$
+ $papersize$paper,
+$endif$
+$for(classoption)$
+ $classoption$$sep$,
+$endfor$
+]{$documentclass$}