#!/bin/sh # RSS/Atom content viewer for a sfeed(5) line. # # Dependencies: # - awk, sh, less or an other pager. # - lynx (or an other tool) for converting HTML to plain-text. awk -F '\t' ' function unescape(s) { gsub("\\\\t", "\t", s); gsub("\\\\n", "\n", s); gsub("\\\\\\\\", "\\", s); return s; } BEGIN { htmlconv = "lynx -stdin -dump " \ "-underline_links -image_links " \ "-display_charset=\"utf-8\" -assume_charset=\"utf-8\" "; } { print "Title: " $2; if (length($7)) print "Author: " $7; if (length($9)) { categories = $9; gsub("\\|", ", ", categories); print "Category: " categories; } if (length($3)) print "Link: " $3; if (length($8)) print "Enclosure: " $8; print ""; if ($5 == "plain") { print unescape($4); } else { print unescape($4) | htmlconv; close(htmlconv); } exit; }' | \ ${PAGER:-less -R}