From 5cf169e88e97cdaa15a302a5cb7d28ce5132be3e Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 24 Nov 2019 14:47:35 +0100
Subject: 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.
---
 sfeed_opml_export | 9 +++------
 1 file 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("&", "\\&amp;");
 	gsub("\"", "\\&quot;");
 	gsub("'"'"'", "\\&#39;");
 	gsub("<", "\\&lt;");
 	gsub(">", "\\&gt;");
 
-	print "\t<outline title=\"" $1 "\" text=\"" $1 "\" xmlUrl=\"" $2 "\" htmlUrl=\"" $3 "\"/>";
+	print "\t<outline type=\"rss\" title=\"" $1 "\" text=\"" $1 "\" xmlUrl=\"" $2 "\"/>";
 }'
 
 cat <<!
-- 
cgit v1.2.3