aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile2
-rw-r--r--README.markdown3
-rw-r--r--bin/htdec.sed4
-rw-r--r--bin/htenc.sed4
-rw-r--r--man/man1/htdec.1df18
-rw-r--r--man/man1/htenc.1df18
7 files changed, 51 insertions, 0 deletions
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_\&lt;_<_g
+s_\&gt;_>_g
+s_\&amp;_\&_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_&_\&amp;_g
+s_<_\&lt;_g
+s_>_\&gt;_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 <tom@sanctum.geek.nz>
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 <tom@sanctum.geek.nz>