commit 9563032f88f6d4689c7ec8b1348c5c8a1fd4b126
parent 2c2b153d5bd0f9aff5480570665733d1b26b329e
Author: Andrew Laack <andrew@laack.co>
Date: Sun, 3 May 2026 13:07:01 -0500
updated escaping; why did they allow escaping??? This break expectations about line characteristics
Diffstat:
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/main.go b/main.go
@@ -2,14 +2,13 @@ package main
import (
"fmt"
+ "github.com/makeworld-the-better-one/go-gemini"
"io"
+ "net/url"
"os"
"strings"
- "net/url"
- "github.com/makeworld-the-better-one/go-gemini"
)
-
func index(url string) (string, []string) {
resp, err := gemini.Fetch(url)
@@ -29,8 +28,16 @@ func index(url string) (string, []string) {
links := []string{}
+ escaped := false
+ escape := "```"
+
for _, item := range lines {
- if len(item) > 3 {
+
+ if strings.Compare(escape, item) == 0 {
+ escaped = !escaped
+ }
+
+ if len(item) > 3 && !escaped {
if item[0] == '=' && item[1] == '>' {
// TODO: is =>link valid?
links = append(links, item[3:])
@@ -62,7 +69,6 @@ func index(url string) (string, []string) {
func main() {
-
// TODO: Read line from file, go from there; append only
// how to multi-thread?
// go mutex duh
@@ -74,9 +80,8 @@ func main() {
fmt.Println(body)
fmt.Println("\n=== Body ===\n")
-
fmt.Println("\n=== Links ===\n")
- for index, link := range(forwardGeminiLinks) {
+ for index, link := range forwardGeminiLinks {
fmt.Printf("%d: %s\n", index, link)
}
fmt.Println("\n=== Links ===\n")
@@ -100,5 +105,4 @@ func main() {
}
}
-
}