commit 5cf169e88e97cdaa15a302a5cb7d28ce5132be3e
parent 8e922657465da745ff7a35ae7b66216de608935c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 24 Nov 2019 14:47:35 +0100
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.
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git 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 <<!