sfeed_content: allow to set HTML converter with env variable

This makes it a bit more easy to reuse the script and makes the run-time
dependency on lynx more optional.

For example with w3m:

	SFEED_HTMLCONV="w3m -I UTF-8 -O UTF-8 -T text/html -dump" \
		sfeed_curses ~/.sfeed/feeds/*

(of course this can be set in a wrapper script or shell profile too)
This commit is contained in:
Hiltjo Posthuma 2021-12-23 18:31:11 +01:00
parent 453ba1b6c1
commit d30a9301ee
2 changed files with 9 additions and 4 deletions

View File

@ -12,9 +12,11 @@ function unescape(s) {
return s;
}
BEGIN {
htmlconv = "lynx -stdin -dump " \
"-underline_links -image_links " \
"-display_charset=\"utf-8\" -assume_charset=\"utf-8\" ";
htmlconv = ENVIRON["SFEED_HTMLCONV"];
if (!length(htmlconv))
htmlconv = "lynx -stdin -dump " \
"-underline_links -image_links " \
"-display_charset=\"utf-8\" -assume_charset=\"utf-8\" ";
}
{
if (previtem)

View File

@ -1,4 +1,4 @@
.Dd July 25, 2021
.Dd December 22, 2021
.Dt SFEED_CONTENT 1
.Os
.Sh NAME
@ -28,6 +28,9 @@ to view content.
.It Ev PAGER
The pager used to view the content.
If it is not set it will use "less -R" by default.
.It Ev SFEED_HTMLCONV
The program used to convert HTML content to plain-text.
If it is not set it will use lynx by default.
.El
.Sh EXIT STATUS
.Ex -std