Put the xmllint logic in a extract_article() function - 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 ad0f37e7635f1859c9800f4ee1b722fd603be1b1 (DIR) parent 5a672ea17f9a5da6a535cf09059bd4f040039c9b (HTM) Author: Leonardo Taccari <iamleot@gmail.com> Date: Sat, 25 Aug 2018 23:02:26 Put the xmllint logic in a extract_article() function Diffstat: internazionale/article.cgi | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) --- diff -r 5a672ea17f9a -r ad0f37e7635f internazionale/article.cgi --- a/internazionale/article.cgi Sat Aug 25 22:34:01 2018 +0200 +++ b/internazionale/article.cgi Sat Aug 25 23:02:26 2018 +0200 @@ -2,6 +2,16 @@ # +# Extract <article> content +# +extract_article() +{ + + /usr/pkg/bin/xmllint --html --format --xpath '//article' - 2>/dev/null +} + + +# # Filter HTML content # filter_html() @@ -53,6 +63,6 @@ url=$2 /usr/pkg/bin/curl -sL "${url}" | - { /usr/pkg/bin/xmllint --html --format --xpath '//article' - 2>/dev/null ; } | + extract_article | filter_html | html_to_text