commit: 1b720a34687959e076a75ee7e4cb0383c6626e49
parent: 5f009121094ef4e40780a09b3017ad8afe88969f
author: Chris Noxz <chris@noxz.tech>
date: Sat, 21 Sep 2019 10:54:42 +0200
Add some support for mathematics in HTML without MathML
2 files changed, 62 insertions(+)
diff --git a/apply-extensions.sh b/apply-extensions.sh
@@ -12,12 +12,21 @@ if [ -f ./articles.ref ]; then
xargs -0 sed -i -e 's,\[\[\([^|]*\)|\([^]]*\)\]\],\1,g'
fi
+# remove spacings between span generators
+find ./noxz.tech/ -name "*.html" -type f -print0 | \
+ xargs -0 sed -i -n \
+ -e 's/^\.*\({-[^}]*}\)/\1/g' \
+ -e 'H;${x;s/\({-[^}]*}[^\n]*\)\n/\1/g;p;}'
+
+# 1. inject span blocks {- ...}, {--}
# 1. inject div blocks {:: ...}, {::}
# 2. inject block parameters {: ...}
# 3. remove comments
# 4. replace 2 en dashs with 1 em dash
find ./noxz.tech/ -name "*.html" -type f -print0 | \
xargs -0 sed -i \
+ -e 's,{--},</span>,g' \
+ -e 's,{-\([^}]*\)},<span\1>,g' \
-e 's,^\(<[^>]*>\){::\( .*\)}$,<div\2>\1,g' \
-e 's,^{::},</div>,g' \
-e 's,^<\([^>]*\)>{:\( .*\)}$,<\1\2>,g' \
diff --git a/noxz.tech/pub/style.css b/noxz.tech/pub/style.css
@@ -221,3 +221,56 @@ ul.repo-log li .log-date {
font-weight : bold;
padding-right : 10px;
}
+
+
+/* math extensions (alternative to MathML) */
+.math {
+ font-family : monospace;
+ /*font-size : 1em;
+ line-height : 1.6em;*/
+}
+
+.math.block {
+ display : block;
+ padding-left : 2em;
+}
+
+.math .hi,
+.math .hi * {
+ border-color : #e667af !important;
+ color : #e667af !important;
+}
+
+.math .hidden {
+ visibility : hidden;
+}
+
+.math .operator {
+ font-family : "Latin Modern Math", "STIX Two Math", "XITS Math",
+ "STIX Math", "Libertinus Math", "TeX Gyre Termes Math",
+ "TeX Gyre Bonum Math", "TeX Gyre Schola",
+ "DejaVu Math TeX Gyre", "TeX Gyre Pagella Math",
+ "Asana Math", "Cambria Math", "Lucida Bright Math",
+ "Minion Math", STIXGeneral, STIXSizeOneSym, Symbol,
+ "Times New Roman", serif;
+ /*font-size : 1em;*/
+ padding : 0 2px;
+ vertical-align : middle;
+}
+
+.math .fraction,
+.math .fraction>span:first-child,
+.math .fraction>span:last-child {
+ padding : 0 2px;
+ vertical-align : middle;
+}
+
+.math .fraction {
+ display : inline-block;
+ text-align : center;
+}
+
+.math .fraction>span:last-child {
+ display : block;
+ border-top : 1px solid #000000;
+}