diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2019-11-24 14:47:35 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2019-11-24 14:47:35 +0100 |
commit | 5cf169e88e97cdaa15a302a5cb7d28ce5132be3e (patch) | |
tree | e3f84166f7106bc4b27443ad0771ece6d118f6f3 | |
parent | 8e922657465da745ff7a35ae7b66216de608935c (diff) |
OPML export improvements
- set type="rss", this is mandatory for OPML2 (although we use OPML v1).
This fixes importing OPML with Mozilla Thunderbird.
other:
- Do not set the optional htmlUrl. This was (ab)used for the baseurl.
- awk: set FS using the awk -F option (no need for OFS here).
- awk: remove forced C locale.
-rwxr-xr-x | sfeed_opml_export | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sfeed_opml_export b/sfeed_opml_export index b2510d4..908f6fb 100755 --- a/sfeed_opml_export +++ b/sfeed_opml_export @@ -26,7 +26,7 @@ loadconfig() { # feed(name, feedurl, [basesiteurl], [encoding]) feed() { # NOTE: TABs in field values are unsupported, be sane. - echo "$1 $2 $3" + echo "$1 $2" } # load config file. @@ -41,17 +41,14 @@ cat <<! <body> ! -feeds | LC_ALL=C awk 'BEGIN { - FS = OFS = "\t"; -} -{ +feeds | awk -F '\t' '{ gsub("&", "\\&"); gsub("\"", "\\""); gsub("'"'"'", "\\'"); gsub("<", "\\<"); gsub(">", "\\>"); - print "\t<outline title=\"" $1 "\" text=\"" $1 "\" xmlUrl=\"" $2 "\" htmlUrl=\"" $3 "\"/>"; + print "\t<outline type=\"rss\" title=\"" $1 "\" text=\"" $1 "\" xmlUrl=\"" $2 "\"/>"; }' cat <<! |