From 5ba8c0894492bd296dd266dd4d6500d53bc9d8e1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 5 Jan 2017 16:22:07 +1300 Subject: Add htenc(1df) and htdec(1df) --- .gitignore | 2 ++ Makefile | 2 ++ README.markdown | 3 +++ bin/htdec.sed | 4 ++++ bin/htenc.sed | 4 ++++ man/man1/htdec.1df | 18 ++++++++++++++++++ man/man1/htenc.1df | 18 ++++++++++++++++++ 7 files changed, 51 insertions(+) create mode 100644 bin/htdec.sed create mode 100644 bin/htenc.sed create mode 100644 man/man1/htdec.1df create mode 100644 man/man1/htenc.1df diff --git a/.gitignore b/.gitignore index 9450b710..bcefffcb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ bin/csmw bin/ddup bin/gwp bin/han +bin/htdec +bin/htenc bin/max bin/mean bin/med diff --git a/Makefile b/Makefile index 19ff8b86..a974c7b1 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,8 @@ BINS = bin/csmw \ bin/ddup \ bin/gwp \ bin/han \ + bin/htdec \ + bin/htenc \ bin/max \ bin/mean \ bin/med \ diff --git a/README.markdown b/README.markdown index 971e764b..707e80cd 100644 --- a/README.markdown +++ b/README.markdown @@ -409,6 +409,9 @@ Installed by the `install-bin` target: * `min(1df)` prints the minimum. * `mode(1df)` prints the first encountered mode. * `tot(1df)` totals the set. +* Two quick-and-dirty HTML text node content encoding tools: + * `htenc(1df)` encodes. + * `htdec(1df)` decodes. * `ap(1df)` reads arguments for a given command from the standard input, prompting if appropriate * `apf(1df)` prepends arguments to a command with ones read from a file, diff --git a/bin/htdec.sed b/bin/htdec.sed new file mode 100644 index 00000000..6f9d6977 --- /dev/null +++ b/bin/htdec.sed @@ -0,0 +1,4 @@ +# Quick-and-dirty HTML text decoding +s_\<_<_g +s_\>_>_g +s_\&_\&_g diff --git a/bin/htenc.sed b/bin/htenc.sed new file mode 100644 index 00000000..0429b525 --- /dev/null +++ b/bin/htenc.sed @@ -0,0 +1,4 @@ +# Quick-and-dirty HTML text encoding +s_&_\&_g +s_<_\<_g +s_>_\>_g diff --git a/man/man1/htdec.1df b/man/man1/htdec.1df new file mode 100644 index 00000000..59862269 --- /dev/null +++ b/man/man1/htdec.1df @@ -0,0 +1,18 @@ +.TH HTDEC 1df "June 2016" "Manual page for htdec" +.SH NAME +.B htdec +\- quick-and-dirty HTML to text decoding for text nodes +.SH SYNOPSIS +.B htdec +/usr/share/lovecraft/the-silver-key.html > the-silver-key.txt +.br +curl http://example.com/netstat.html | +.B htdec +.SH DESCRIPTION +.B htdec +unescapes left angle quotes, right angle quotes, and ampersands to put HTML +text node content into plain text. +.SH SEE ALSO +htdec(1df) +.SH AUTHOR +Tom Ryder diff --git a/man/man1/htenc.1df b/man/man1/htenc.1df new file mode 100644 index 00000000..57e4d308 --- /dev/null +++ b/man/man1/htenc.1df @@ -0,0 +1,18 @@ +.TH HTENC 1df "June 2016" "Manual page for htenc" +.SH NAME +.B htenc +\- quick-and-dirty text to HTML encoding for text nodes +.SH SYNOPSIS +.B htenc +/usr/share/lovecraft/the-silver-key.txt > the-silver-key.html +.br +netstat -aunt | +.B htenc > netstat.html +.SH DESCRIPTION +.B htenc +escapes ampersands, left angle quotes, and right angle quotes to put text into +a form that should be suitable to include in XML/HTML text nodes. +.SH SEE ALSO +htdec(1df) +.SH AUTHOR +Tom Ryder -- cgit v1.2.3