Skip to content

Commit

Permalink
Fixup conversion to HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
jirilebl committed Jun 8, 2021
1 parent af98eb2 commit 168bcbe
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 27 deletions.
7 changes: 4 additions & 3 deletions convert-to-mbx.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1306,16 +1306,17 @@ sub read_paragraph {
if ($title ne "") {
print $out "<title>$title</title>\n";
}
if ($footnote ne "") {
print $out "$footnote\n";
}
if ($indexo ne "") {
print $out "$indexo\n";
}
print $out "<statement>\n";

open_paragraph();

if ($footnote ne "") {
print $out "$footnote\n";
}

} elsif ($para =~ s/^\\end\{(thm|lemma|prop|cor|defn)\}[ \n]*//) {
close_paragraph();
my $type = $1;
Expand Down
22 changes: 11 additions & 11 deletions convert-to-mbx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 ...
Expand Down
9 changes: 9 additions & 0 deletions figures/optimize-svgs.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 8 additions & 7 deletions fixup-html-file.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<script type=\"text/x-mathjax-config\">\n";
print " MathJax.Hub.Config({\n";
print " \"fast-preview\": {\n";
print " disabled: true,\n";
print " },\n";
print " });\n";
print "</script>\n";
# Note: Doesn't really work in MathJax3, but it's probably not needed anymore
#print "<script type=\"text/x-mathjax-config\">\n";
#print " MathJax.Hub.Config({\n";
#print " \"fast-preview\": {\n";
#print " disabled: true,\n";
#print " },\n";
#print " });\n";
#print "</script>\n";

print "<style>\n";
# Not really critical, avoids flashing some LaTeX code on initial load, as external .css files get loaded slowly
Expand Down
6 changes: 3 additions & 3 deletions realanal-html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<xsl:value-of select="false()" />
</xsl:template>

<xsl:param name="html.knowl.theorem" select="'no'"/>
<!--<xsl:param name="html.knowl.theorem" select="'no'"/>
<xsl:param name="html.knowl.proof" select="'no'"/>
<xsl:param name="html.knowl.definition" select="'no'"/>
<xsl:param name="html.knowl.example" select="'no'"/>
Expand All @@ -143,13 +143,13 @@
<xsl:param name="html.knowl.table" select="'no'"/>
<xsl:param name="html.knowl.listing" select="'no'"/>
<xsl:param name="html.knowl.exercise.inline" select="'no'"/>
<xsl:param name="html.knowl.exercise.sectional" select="'no'"/>
<xsl:param name="html.knowl.exercise.sectional" select="'no'"/>-->

<xsl:param name="debug.datedfiles" select="'no'"/>

<xsl:param name="html.css.extra" select="'extra.css'"/>

<!--<xsl:param name="publisher" select="'./realanal-publisher.xml'"/>-->
<xsl:param name="html.google-search" select="'006490116505509195242:bj7la1eakgo'"/>
<!--<xsl:param name="html.google-search" select="'006490116505509195242:bj7la1eakgo'"/>-->

</xsl:stylesheet>
15 changes: 12 additions & 3 deletions realanal-publisher.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<!--
CAN'T GET IT TO WORK STILL USING STRINGPARAMS in realanal-html.xsl
-->
<?xml version="1.0" encoding="UTF-8" ?>
<publication>

Expand All @@ -15,6 +12,18 @@
<!-- Google search, via masthead textbox is switched on -->
<!-- and associated with a Google account via CX number -->
<search google-cx="006490116505509195242:bj7la1eakgo"/>

<knowl theorem="no" />
<knowl proof="no" />
<knowl definition="no" />
<knowl example="no" />
<knowl list="no" />
<knowl remark="no" />
<knowl figure="no" />
<knowl table="no" />
<knowl listing="no" />
<knowl exercise-inline="no" />
<knowl exercise-sectional="no" />
</html>

</publication>

0 comments on commit 168bcbe

Please sign in to comment.