shithub: hell

Download patch

ref: 173303fc18778636dc8a25de62056face05eea37
parent: 2d617f3d1ca03d888c2cae2ea5b40d2d663abd0c
author: penny <penny@limitedideas.org>
date: Mon Nov 10 16:48:02 EST 2025

URL/hashtag fixes plus hashtags render right in /edit

--- a/commands.go
+++ b/commands.go
@@ -773,7 +773,7 @@
 	cmd.bflags = status | templater
 	cmd.doer = func(data *cmddata) string {
 		replyLine := ""
-		if data.status.InReplyToAccountID != 0 {
+		if data.status.InReplyToAccountID != nil {
 			var account *mastodon.Account
 			var err error
 			getaccount := func() {
--- a/edit.go
+++ b/edit.go
@@ -4,6 +4,7 @@
 	"bytes"
 	"errors"
 	"strings"
+	"fmt"
 
 	mastodon "codeberg.org/penny64/hellclient-go-mastodon"
 	"golang.org/x/net/html"
@@ -20,9 +21,15 @@
 		if node.Data == "a" && node.Type == html.ElementNode {
 			ismention := false
 			for attr := range node.Attr {
-				if node.Attr[attr].Key == "class" && strings.Contains(node.Attr[attr].Val, "mention") {
+				if node.Attr[attr].Key == "class" && strings.Contains(node.Attr[attr].Val, "mention") && !strings.Contains(node.Attr[attr].Val, "hashtag") {
 					ismention = true
 					continue
+				}
+				if node.Attr[attr].Key == "class" && strings.Contains(node.Attr[attr].Val, "hashtag") {
+					if node.FirstChild != nil && node.FirstChild.Type == html.TextNode {
+						node.Attr[attr].Val = fmt.Sprintf("#%s", node.FirstChild.Data)
+						node.Data = "div"
+					}
 				}
 			}
 			if ismention {
--- a/renderer.go
+++ b/renderer.go
@@ -239,12 +239,17 @@
 		}
 		if node.Data == "a" && node.Type == html.ElementNode {
 			ismention := false
+			ishashtag := false
 			href := ""
 
 			for attr := range node.Attr {
 				if node.Attr[attr].Key == "class" && strings.Contains(node.Attr[attr].Val, "mention") {
 					node.Data = "div"
-					ismention = true
+					if !strings.Contains(node.Attr[attr].Val, "hashtag") {
+						ismention = true
+					} else {
+						ishashtag = true
+					}
 					continue
 				}
 				if node.Attr[attr].Key == "href" {
@@ -255,7 +260,7 @@
 					}
 				}
 			}
-			if !ismention && href != "" {
+			if !ismention && !ishashtag && href != "" {
 				pr.urlmap[index] = append(pr.urlmap[index], href)
 				refnode := &html.Node{
 					Type: html.TextNode,
--- a/todo.md
+++ b/todo.md
@@ -2,7 +2,7 @@
  - [ ] Undo timeout
  - [ ] […] long posts
  - [ ] Test mode that doesn’t  actually send statuses
- - [ ] Hashtag support + works with edit
+ - [ ] Hashtag search
  - [ ] Poll support
  - [ ] lists
  - [ ] Interupt handler
@@ -27,6 +27,7 @@
  - [ ] authorize oauth tokens
  - [ ] plaintext => self authorize oauth
  - [ ] -h and -w to specify size of output
+ - [x] Hashtags work in /edit
  - [x] Thread context in /cat
  - [x] label hellclient
  - [x] display name in /cat
--