aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2019-11-05 10:39:03 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2019-11-05 16:39:03 +0800
commit05e7715c4b2af174aefc56fe459e5c08a96a3017 (patch)
treecb8ef6aa941d48a407d2bdbe2b0ba2df842e2148 /modules/markup
parent2f4ef84cbfe1f7913434f531e8d61d232238b58a (diff)
downloadgitea-05e7715c4b2af174aefc56fe459e5c08a96a3017.tar.gz
gitea-05e7715c4b2af174aefc56fe459e5c08a96a3017.zip
Update go-org to optimize code (#8824)
Diffstat (limited to 'modules/markup')
-rw-r--r--modules/markup/orgmode/orgmode.go21
1 files changed, 1 insertions, 20 deletions
diff --git a/modules/markup/orgmode/orgmode.go b/modules/markup/orgmode/orgmode.go
index 54188d2734..86222cc88e 100644
--- a/modules/markup/orgmode/orgmode.go
+++ b/modules/markup/orgmode/orgmode.go
@@ -8,7 +8,6 @@ import (
"bytes"
"fmt"
"html"
- "strings"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markup"
@@ -91,7 +90,7 @@ func (r *Renderer) WriteRegularLink(l org.RegularLink) {
description := string(link)
if l.Description != nil {
- description = r.nodesAsString(l.Description...)
+ description = r.WriteNodesAsString(l.Description...)
}
switch l.Kind() {
case "image":
@@ -102,21 +101,3 @@ func (r *Renderer) WriteRegularLink(l org.RegularLink) {
r.WriteString(fmt.Sprintf(`<a href="%s" title="%s">%s</a>`, link, description, description))
}
}
-
-func (r *Renderer) emptyClone() *Renderer {
- wcopy := *(r.HTMLWriter)
- wcopy.Builder = strings.Builder{}
-
- rcopy := *r
- rcopy.HTMLWriter = &wcopy
-
- wcopy.ExtendingWriter = &rcopy
-
- return &rcopy
-}
-
-func (r *Renderer) nodesAsString(nodes ...org.Node) string {
- tmp := r.emptyClone()
- org.WriteNodes(tmp, nodes...)
- return tmp.String()
-}