git.iko.soy/typeable/pandoc
on master help sign in
Restored and undeprecated gladtex for HTML math.
b7356d3John MacFarlane
MANUAL.txt+12
@@ -1217,9 +1217,21 @@ of the following options.
1217 not specified, a link to the KaTeX CDN will be inserted. Note that this
1217 not specified, a link to the KaTeX CDN will be inserted. Note that this
1218 option does not imply `--katex`.
1218 option does not imply `--katex`.
1219
1219
1220+`--gladtex`
1221+
1222+: Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1223+ can then be processed by [GladTeX] to produce images of the typeset
1224+ formulas and an HTML file with links to these images.
1225+ So, the procedure is:
1226+
1227+ pandoc -s --gladtex input.md -o myfile.htex
1228+ gladtex -d myfile-images myfile.htex
1229+ # produces myfile.html and images in myfile-images
1230+
1220[MathML]: http://www.w3.org/Math/
1231[MathML]: http://www.w3.org/Math/
1221[MathJax]: https://www.mathjax.org
1232[MathJax]: https://www.mathjax.org
1222[KaTeX]: https://github.com/Khan/KaTeX
1233[KaTeX]: https://github.com/Khan/KaTeX
1234+[GladTeX]: http://humenda.github.io/GladTeX/
1223
1235
1224Options for wrapper scripts
1236Options for wrapper scripts
1225---------------------------
1237---------------------------
man/pandoc.1+40−6
@@ -647,8 +647,7 @@ a specified full or relative path (executable or non\-executable)
647.B \f[C]\-M\f[] \f[I]KEY\f[][\f[C]=\f[]\f[I]VAL\f[]], \f[C]\-\-metadata=\f[]\f[I]KEY\f[][\f[C]:\f[]\f[I]VAL\f[]]
647.B \f[C]\-M\f[] \f[I]KEY\f[][\f[C]=\f[]\f[I]VAL\f[]], \f[C]\-\-metadata=\f[]\f[I]KEY\f[][\f[C]:\f[]\f[I]VAL\f[]]
648Set the metadata field \f[I]KEY\f[] to the value \f[I]VAL\f[].
648Set the metadata field \f[I]KEY\f[] to the value \f[I]VAL\f[].
649A value specified on the command line overrides a value specified in the
649A value specified on the command line overrides a value specified in the
650−document using [YAML metadata
650+document using YAML metadata blocks.
651−blocks][Extension:\f[C]yaml_metadata_block\f[]].
652Values will be parsed as YAML boolean or string values.
651Values will be parsed as YAML boolean or string values.
653If no value is specified, the value will be treated as Boolean true.
652If no value is specified, the value will be treated as Boolean true.
654Like \f[C]\-\-variable\f[], \f[C]\-\-metadata\f[] causes template
653Like \f[C]\-\-variable\f[], \f[C]\-\-metadata\f[] causes template
@@ -727,6 +726,8 @@ Produce output with an appropriate header and footer (e.g.
727a standalone HTML, LaTeX, TEI, or RTF file, not a fragment).
726a standalone HTML, LaTeX, TEI, or RTF file, not a fragment).
728This option is set automatically for \f[C]pdf\f[], \f[C]epub\f[],
727This option is set automatically for \f[C]pdf\f[], \f[C]epub\f[],
729\f[C]epub3\f[], \f[C]fb2\f[], \f[C]docx\f[], and \f[C]odt\f[] output.
728\f[C]epub3\f[], \f[C]fb2\f[], \f[C]docx\f[], and \f[C]odt\f[] output.
729+For \f[C]native\f[] output, this option causes metadata to be included;
730+otherwise, metadata is suppressed.
730.RS
731.RS
731.RE
732.RE
732.TP
733.TP
@@ -1413,6 +1414,22 @@ inserted.
1413Note that this option does not imply \f[C]\-\-katex\f[].
1414Note that this option does not imply \f[C]\-\-katex\f[].
1414.RS
1415.RS
1415.RE
1416.RE
1417+.TP
1418+.B \f[C]\-\-gladtex\f[]
1419+Enclose TeX math in \f[C]<eq>\f[] tags in HTML output.
1420+The resulting HTML can then be processed by GladTeX to produce images of
1421+the typeset formulas and an HTML file with links to these images.
1422+So, the procedure is:
1423+.RS
1424+.IP
1425+.nf
1426+\f[C]
1427+pandoc\ \-s\ \-\-gladtex\ input.md\ \-o\ myfile.htex
1428+gladtex\ \-d\ myfile\-images\ myfile.htex
1429+#\ produces\ myfile.html\ and\ images\ in\ myfile\-images
1430+\f[]
1431+.fi
1432+.RE
1416.SS Options for wrapper scripts
1433.SS Options for wrapper scripts
1417.TP
1434.TP
1418.B \f[C]\-\-dump\-args\f[]
1435.B \f[C]\-\-dump\-args\f[]
@@ -1489,9 +1506,8 @@ arbitrary information at any point in the file.
1489They may be set at the command line using the \f[C]\-V/\-\-variable\f[]
1506They may be set at the command line using the \f[C]\-V/\-\-variable\f[]
1490option.
1507option.
1491If a variable is not set, pandoc will look for the key in the
1508If a variable is not set, pandoc will look for the key in the
1492−document\[aq]s metadata \[en] which can be set using either [YAML
1509+document\[aq]s metadata \[en] which can be set using either YAML
1493−metadata blocks][Extension:\f[C]yaml_metadata_block\f[]] or with the
1494−\f[C]\-\-metadata\f[] option.
1510+metadata blocks or with the \f[C]\-\-metadata\f[] option.
1495.SS Variables set by pandoc
1511.SS Variables set by pandoc
1496.PP
1512.PP
1497Some variables are set automatically by pandoc.
1513Some variables are set automatically by pandoc.
@@ -2081,7 +2097,25 @@ $endif$
2081.fi
2097.fi
2082.PP
2098.PP
2083This will include \f[C]X\f[] in the template if \f[C]variable\f[] has a
2099This will include \f[C]X\f[] in the template if \f[C]variable\f[] has a
2084−non\-null value; otherwise it will include \f[C]Y\f[].
2100+truthy value; otherwise it will include \f[C]Y\f[].
2101+Here a truthy value is any of the following:
2102+.IP \[bu] 2
2103+a string that is not entirely white space,
2104+.IP \[bu] 2
2105+a non\-empty array where the first value is truthy,
2106+.IP \[bu] 2
2107+any number (including zero),
2108+.IP \[bu] 2
2109+any object,
2110+.IP \[bu] 2
2111+the boolean \f[C]true\f[] (to specify the boolean \f[C]true\f[] value
2112+using YAML metadata or the \f[C]\-\-metadata\f[] flag, use \f[C]y\f[],
2113+\f[C]Y\f[], \f[C]yes\f[], \f[C]Yes\f[], \f[C]YES\f[], \f[C]true\f[],
2114+\f[C]True\f[], \f[C]TRUE\f[], \f[C]on\f[], \f[C]On\f[], or \f[C]ON\f[];
2115+with the \f[C]\-\-variable\f[] flag, simply omit a value for the
2116+variable, e.g.
2117+\f[C]\-\-variable\ draft\f[]).
2118+.PP
2085\f[C]X\f[] and \f[C]Y\f[] are placeholders for any valid template text,
2119\f[C]X\f[] and \f[C]Y\f[] are placeholders for any valid template text,
2086and may include interpolated variables or other conditionals.
2120and may include interpolated variables or other conditionals.
2087The \f[C]$else$\f[] section may be omitted.
2121The \f[C]$else$\f[] section may be omitted.
src/Text/Pandoc/App.hs+6
@@ -1403,6 +1403,12 @@ options =
1403 "URL")
1403 "URL")
1404 "" -- Use KaTeX for HTML Math
1404 "" -- Use KaTeX for HTML Math
1405
1405
1406+ , Option "" ["gladtex"]
1407+ (NoArg
1408+ (\opt ->
1409+ return opt { optHTMLMathMethod = GladTeX }))
1410+ "" -- "Use gladtex for HTML math"
1411+
1406 , Option "" ["abbreviations"]
1412 , Option "" ["abbreviations"]
1407 (ReqArg
1413 (ReqArg
1408 (\arg opt -> return opt { optAbbreviations = Just arg })
1414 (\arg opt -> return opt { optAbbreviations = Just arg })
src/Text/Pandoc/Options.hs+1
@@ -107,6 +107,7 @@ data EPUBVersion = EPUB2 | EPUB3 deriving (Eq, Show, Read, Data, Typeable, Gener
107
107
108data HTMLMathMethod = PlainMath
108data HTMLMathMethod = PlainMath
109 | WebTeX String -- url of TeX->image script.
109 | WebTeX String -- url of TeX->image script.
110+ | GladTeX
110 | MathML
111 | MathML
111 | MathJax String -- url of MathJax.js
112 | MathJax String -- url of MathJax.js
112 | KaTeX String -- url of KaTeX files
113 | KaTeX String -- url of KaTeX files
src/Text/Pandoc/Writers/HTML.hs+8−1
@@ -58,7 +58,7 @@ import qualified Data.Text.Lazy as TL
58import Network.HTTP (urlEncode)
58import Network.HTTP (urlEncode)
59import Network.URI (URI (..), parseURIReference, unEscapeString)
59import Network.URI (URI (..), parseURIReference, unEscapeString)
60import Numeric (showHex)
60import Numeric (showHex)
61−import Text.Blaze.Internal (customLeaf, MarkupM(Empty))
61+import Text.Blaze.Internal (customLeaf, customParent, MarkupM(Empty))
62#if MIN_VERSION_blaze_markup(0,6,3)
62#if MIN_VERSION_blaze_markup(0,6,3)
63#else
63#else
64import Text.Blaze.Internal (preEscapedString, preEscapedText)
64import Text.Blaze.Internal (preEscapedString, preEscapedText)
@@ -1029,6 +1029,13 @@ inlineToHtml opts inline = do
1029 return $ case t of
1029 return $ case t of
1030 InlineMath -> m
1030 InlineMath -> m
1031 DisplayMath -> brtag >> m >> brtag
1031 DisplayMath -> brtag >> m >> brtag
1032+ GladTeX ->
1033+ return $
1034+ customParent (textTag "eq") !
1035+ customAttribute "env"
1036+ (toValue $ if t == InlineMath
1037+ then ("math" :: Text)
1038+ else "displaymath") $ strToHtml str
1032 MathML -> do
1039 MathML -> do
1033 let conf = useShortEmptyTags (const False)
1040 let conf = useShortEmptyTags (const False)
1034 defaultConfigPP
1041 defaultConfigPP