From 168bcbed1496a7dfc654ffe393a633b0e84e1b5f Mon Sep 17 00:00:00 2001 From: "Jiri (George) Lebl" Date: Tue, 8 Jun 2021 14:18:31 -0700 Subject: [PATCH] Fixup conversion to HTML --- convert-to-mbx.pl | 7 ++++--- convert-to-mbx.sh | 22 +++++++++++----------- figures/optimize-svgs.sh | 9 +++++++++ fixup-html-file.pl | 15 ++++++++------- realanal-html.xsl | 6 +++--- realanal-publisher.xml | 15 ++++++++++++--- 6 files changed, 47 insertions(+), 27 deletions(-) create mode 100755 figures/optimize-svgs.sh diff --git a/convert-to-mbx.pl b/convert-to-mbx.pl index 1feda03..654089e 100755 --- a/convert-to-mbx.pl +++ b/convert-to-mbx.pl @@ -1306,9 +1306,6 @@ sub read_paragraph { if ($title ne "") { print $out "$title\n"; } - if ($footnote ne "") { - print $out "$footnote\n"; - } if ($indexo ne "") { print $out "$indexo\n"; } @@ -1316,6 +1313,10 @@ sub read_paragraph { open_paragraph(); + if ($footnote ne "") { + print $out "$footnote\n"; + } + } elsif ($para =~ s/^\\end\{(thm|lemma|prop|cor|defn)\}[ \n]*//) { close_paragraph(); my $type = $1; diff --git a/convert-to-mbx.sh b/convert-to-mbx.sh index c393ff2..43b587c 100755 --- a/convert-to-mbx.sh +++ b/convert-to-mbx.sh @@ -3,7 +3,7 @@ echo Conversion to HTML through PreTeXt. It is still beta quality and work in echo progress. The realanal-html.xsl assumes a fixed location for the PreTeXt echo xsl file. You need to edit this first. echo Do ^C to get out. -echo +echo echo You should first run with --runpdft --optimize-svg which echo runs the pdft figures and then also optimizes svgs. Without echo --runpdft some figures will be missing. You can also use --full @@ -89,15 +89,15 @@ perl convert-to-mbx.pl #xmllint --format -o realanal-out2.xml realanal-out.xml -#if [ "$OPTSVG" = "yes" ] ; then -# echo -# echo OPTIMIZING SVG... -# echo -# -# cd figures -# ./optimize-svgs.sh -# cd .. -#fi +if [ "$OPTSVG" = "yes" ] ; then + echo + echo OPTIMIZING SVG... + echo + + cd figures + ./optimize-svgs.sh + cd .. +fi echo echo MOVING OLD html, CREATING NEW html, COPYING figures/ in there @@ -116,7 +116,7 @@ echo echo RUNNING xsltproc echo -xsltproc ../realanal-html.xsl ../realanal-out.xml +xsltproc -stringparam publisher realanal-publisher.xml ../realanal-html.xsl ../realanal-out.xml echo echo FIXING UP HTML ... diff --git a/figures/optimize-svgs.sh b/figures/optimize-svgs.sh new file mode 100755 index 0000000..0183ef3 --- /dev/null +++ b/figures/optimize-svgs.sh @@ -0,0 +1,9 @@ +#!/bin/zsh + +echo OPTIMIZING SVG... +for n in *.svg ; do + #echo svgo --disable=convertPathData --multipass $n + #svgo --disable=convertPathData --multipass $n + echo svgo --multipass $n + svgo --multipass $n +done diff --git a/fixup-html-file.pl b/fixup-html-file.pl index 11e5a95..252b920 100755 --- a/fixup-html-file.pl +++ b/fixup-html-file.pl @@ -53,13 +53,14 @@ } if ($line =~ m/<\/head>/) { # Fast preview doesn't seem worth it and it could be confusing since it's not quite right so disable it - print "\n"; + # Note: Doesn't really work in MathJax3, but it's probably not needed anymore + #print "\n"; print "