ref: 787e0e641d5e4e4aeb89da6b5eecfc4c954c57c9
parent: 78ac6a671de03d1101955f2f3b390bfae7fc4673
author: penny <penny@limitedideas.org>
date: Mon Sep 8 21:25:06 EDT 2025
titled URLs are displayed as their titles
--- a/main.go
+++ b/main.go
@@ -151,10 +151,10 @@
switch command {case "examine":
if postOK {- PrintObjectProperties(postItem, debugMap)
+ hc.PrintObjectProperties(postItem)
return
}
- PrintObjectProperties(debugItem, debugMap)
+ hc.PrintObjectProperties(debugItem)
return
}
--- a/mastodon.go
+++ b/mastodon.go
@@ -100,6 +100,12 @@
}
if node.Attr[attr].Key == "href" {href = node.Attr[attr].Val
+ //Replace the href with the description if the URL has one
+ if node.FirstChild != nil && node.FirstChild.Type == html.TextNode && !ismention {+ node.Attr[attr].Val = fmt.Sprintf("(%v)", node.FirstChild.Data)+ } else {+ href = href + " "
+ }
}
}
if !ismention {@@ -106,7 +112,7 @@
hc.urlMap[index] = append(hc.urlMap[index], href)
refnode := &html.Node{Type: html.TextNode,
- Data: fmt.Sprintf(" [%v]", len(hc.urlMap[index]))}+ Data: fmt.Sprintf("[%v]", len(hc.urlMap[index]))} if node.Parent != nil {node.Parent.InsertBefore(refnode, node.NextSibling)
}
--- a/reflect.go
+++ b/reflect.go
@@ -5,7 +5,7 @@
"reflect"
)
-func PrintObjectProperties(obj interface{}, debugMap map[string]interface{}) {+func (hc *Hellclient) PrintObjectProperties(obj interface{}) {val := reflect.ValueOf(obj)
if val.Kind() == reflect.Ptr {@@ -26,7 +26,7 @@
fieldType := typ.Field(i)
if fieldType.IsExported() {- saveDebugRef(debugMap, fieldValue.Interface(), index)
+ saveDebugRef(hc.debugMap, fieldValue.Interface(), index)
fmt.Printf("!%s %s: %v\n", index, fieldType.Name, fieldValue.Interface())index = IncrementString(index)
}
--
⑨