Additional fixes to the html.sed script

It now translates the characters '|' (pipe), '=' (equals) and '%'
(percent).

Checks were added in md2html.sh in the -s token=value so that token
cannot contain an = (equal), | (pipe) or a % (percent) and the value
cannot contain a | (pipe).

The reason that we cannot disallow a ';' or '&' is because the html
entities use those characters so if the sed script were to translate the
problematic characters it would cause a problem in the script.

Ran make www which updated 1988/robison/index.html and
1990/theorem/index.html.

1986/bright/README.md was fixed with the number of blank lines between
sections.
This commit is contained in:
Cody Boone Ferguson committed 2024-11-07 10:37:51 -08:00
1 parent 9787cc3a12
commit 6fa0f7b69a
6 files changed
+51 -15

No files matched your search

+7 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env sed
#
# bin/html.sed - translate certain characters to HTML & entities
# html.sed - translate certain characters to HTML & entities
#
# This script was written in 2024 November by:
#
@@ -11,10 +11,10 @@
# "Because sometimes even the IOCCC Judges need some help." :-)
#
# This script will take certain characters, for instance '<', and convert them
# to their respective html entity, for instance '&lt;', so that html lints do
# to their respective HTML entity, for instance '&lt;', so that HTML lints do
# not complain.
#
# For a list of the other html entities, should others be needed, see:
# For a list of the other HTML entities, should others be needed, see:
#
# https://www.w3schools.com/html/html_entities.asp
#
@@ -26,7 +26,7 @@
#
# sed -i -f bin/html.sed file
#
# VERSION="1.0 2024-11-04"
# VERSION="1.1 2024-11-07"
# IMPORTANT NOTE: the '&amp;' substitution MUST come first! This is because the
# other substitutions have '&'s in them and if the '&amp;' came after it would
@@ -34,3 +34,6 @@
s/&/\\\&amp;/g
s/</\\\&lt;/g
s/>/\\\&gt;/g
s/|/\\\&verbar;/g
s/=/\\\&equals;/g
s/%/\\\&percnt;/g