]> Sergey Matveev's repositories - linksexp.git/blobdiff - main.go
gemini:// support
[linksexp.git] / main.go
diff --git a/main.go b/main.go
index 875291dfc7263187959d7ff589fe88f93673cedc..f2d7d183810c6bdd1f33b05948b2168359cad602 100644 (file)
--- a/main.go
+++ b/main.go
@@ -60,6 +60,9 @@ func 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)
                        }
                }
@@ -148,7 +151,10 @@ func main() {
                        }
                        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) {
@@ -161,7 +167,10 @@ func main() {
                                )
                        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,
+                                       )
                                }
                        }
                }