Add a common/html.sh directory to avoid duplicate code in CGIs - gophercgis - Collection of gopher CGI/DCGI for geomyidae (HTM) hg clone https://bitbucket.org/iamleot/gophercgis (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) changeset 050d4c8f3777b68d0546057f5c3c42ed1e303664 (DIR) parent 85a5fa9ab6912fd661e5f4870e761c90c0c3650c (HTM) Author: Leonardo Taccari <iamleot@gmail.com> Date: Fri, 7 Sep 2018 01:13:41 Add a common/html.sh directory to avoid duplicate code in CGIs Diffstat: common/html.sh | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) --- diff -r 85a5fa9ab691 -r 050d4c8f3777 common/html.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/html.sh Fri Sep 07 01:13:41 2018 +0200 @@ -0,0 +1,20 @@ +#!/bin/sh + + +# +# Render HTML as text +# +html_to_text() +{ + # Nonexistent proxy to block HTTP requests + export http_proxy="http://localhost:31283128" + + browser="/usr/pkg/bin/w3m" + + browser_options="-dump -T text/html -no-cookie -cols 72" + browser_options="${browser_options} -o display_link=false" + browser_options="${browser_options} -o display_link_number=false" + browser_options="${browser_options} -o display_image=false" + + env LANG=en_US.UTF-8 ${browser} ${browser_options} +}