-/*
-linksexp -- Texinfo/XBEL/OPML/urls autogeneration from recfile bookmark
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+// linksexp -- Texinfo/XBEL/OPML/urls autogeneration from recfile bookmark
+// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
sort.Strings(m["Category"])
cats := strings.Join(m["Category"], " ")
for _, f := range m["Feed"] {
+ if strings.HasPrefix(f, "gemini://") {
+ f = "https://gemini/" + f
+ }
fmt.Println(f, cats)
}
}
}
fmt.Printf(
" @item %d @tab @url{%s,, %s} %s @tab %s @tab\n",
- n, ent["URL"][0], ent["Title"][0], note,
+ n,
+ strings.ReplaceAll(ent["URL"][0], "@", "@@"),
+ strings.ReplaceAll(ent["Title"][0], "@", "@@"),
+ note,
strings.Join(catsOther, ", "),
)
switch feeds := ent["Feed"]; len(feeds) {
)
default:
for i, feed := range feeds {
- fmt.Printf(" @url{%s, feed%d}\n", feed, i)
+ fmt.Printf(
+ " @url{%s, feed%d}\n",
+ strings.ReplaceAll(feed, "@", "@@"), i,
+ )
}
}
}