aboutsummaryrefslogtreecommitdiff
path: root/ui/messages
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-04-15 00:34:48 +0300
committerTulir Asokan <tulir@maunium.net>2019-04-15 00:34:48 +0300
commit60e3fe392711ef233aa68a062a7ee96d145d2cb4 (patch)
treec6ace782670087ab6d6a585034ca098b7eae0ade /ui/messages
parent98a8b528624c9f497c213afe66fb738cf15f2c82 (diff)
Stop replacing text of event links
Diffstat (limited to 'ui/messages')
-rw-r--r--ui/messages/html/parser.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/ui/messages/html/parser.go b/ui/messages/html/parser.go
index 51f5cb0..bc93e9d 100644
--- a/ui/messages/html/parser.go
+++ b/ui/messages/html/parser.go
@@ -168,8 +168,8 @@ func (parser *htmlParser) blockquoteToEntity(node *html.Node) Entity {
return NewBlockquoteEntity(parser.nodeToEntities(node.FirstChild))
}
-func (parser *htmlParser) linkToEntity(node *html.Node) (entity Entity) {
- entity = &ContainerEntity{
+func (parser *htmlParser) linkToEntity(node *html.Node) Entity {
+ entity := &ContainerEntity{
BaseEntity: &BaseEntity{
Tag: "a",
},
@@ -177,27 +177,27 @@ func (parser *htmlParser) linkToEntity(node *html.Node) (entity Entity) {
}
href := parser.getAttribute(node, "href")
if len(href) == 0 {
- return
+ return entity
}
match := matrixToURL.FindStringSubmatch(href)
if len(match) == 2 {
pillTarget := match[1]
- textEntity := &TextEntity{
- BaseEntity: &BaseEntity{
- Tag: "a",
- },
- Text: pillTarget,
- }
+ text := NewTextEntity(pillTarget)
if pillTarget[0] == '@' {
if member := parser.room.GetMember(pillTarget); member != nil {
- textEntity.Text = member.Displayname
- textEntity.Style = textEntity.Style.Foreground(widget.GetHashColor(pillTarget))
+ text.Text = member.Displayname
+ text.Style = text.Style.Foreground(widget.GetHashColor(pillTarget))
}
+ entity.Children = []Entity{text}
+ /*} else if slash := strings.IndexRune(pillTarget, '/'); slash != -1 {
+ room := pillTarget[:slash]
+ event := pillTarget[slash+1:]*/
+ } else if pillTarget[0] == '#' {
+ entity.Children = []Entity{text}
}
- entity = textEntity
}
// TODO add click action and underline on hover for links
- return
+ return entity
}
func (parser *htmlParser) imageToEntity(node *html.Node) Entity {