From ad90b883170f1b78a39102dc80c62802d9d5550d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 4 Nov 2024 06:59:31 -0800 Subject: [PATCH] Add html.sed to translate certain characters The script, for now, translates the following characters to their html entity: &, <, > An important note that is in a comment is that the & MUST come first as otherwise the & in the others will be corrupted. One script uses this but in order to make sure it is okay make www will have to be run first. Another script, the one that needs it even more, has a problem that has to be discussed, before it can be used. Nonetheless the html.sed file is at least added for the scripts once things are tested okay. --- bin/html.sed | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 bin/html.sed diff --git a/bin/html.sed b/bin/html.sed new file mode 100644 index 000000000..b81a37064 --- /dev/null +++ b/bin/html.sed @@ -0,0 +1,32 @@ +#!/usr/bin/env sed +# +# bin/html.sed - translate certain characters to HTML & entities +# +# This script was written in 2024 November by: +# +# @xexyl +# https://xexyl.net Cody Boone Ferguson +# https://ioccc.xexyl.net +# +# "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 '<', so that html lints do +# not complain. +# +# usage: +# +# cmd | sed -f bin/html.sed +# +# sed -f bin/html.sed file > output +# +# sed -i -f bin/html.sed file +# +# VERSION="1.0 2024-11-04" + +# IMPORTANT NOTE: the '&' substitution MUST come first! This is because the +# other substitutions have '&'s in them and if the '&' came after it would +# corrupt the '&'s in the string. +s/&/\&/g +s//\>/g