tangled
alpha
login
or
join now
byjp.me
/
dotpostcard
0
fork
atom
A tool for archiving & converting scans of postcards, and information about them.
0
fork
atom
overview
issues
pulls
pipelines
fix: Correct HTML output for underline Annotation
byjp.me
1 year ago
42701b9e
79f192c1
+12
-2
1 changed file
expand all
collapse all
unified
split
types
annotations.go
+12
-2
types/annotations.go
···
86
86
return outHTML.String()
87
87
}
88
88
89
89
+
var htmlMap = map[AnnotationType]string{
90
90
+
ATEmphasis: "em",
91
91
+
ATStrong: "strong",
92
92
+
ATUnderline: "underline",
93
93
+
}
94
94
+
89
95
func (a Annotation) HTMLTag(isOpen bool) string {
90
96
switch a.Type {
91
97
case ATLocale:
···
95
101
return "</span>"
96
102
}
97
103
default:
104
104
+
tag, ok := htmlMap[a.Type]
105
105
+
if !ok {
106
106
+
return ""
107
107
+
}
98
108
if isOpen {
99
99
-
return fmt.Sprintf("<%s>", a.Type)
109
109
+
return fmt.Sprintf("<%s>", tag)
100
110
} else {
101
101
-
return fmt.Sprintf("</%s>", a.Type)
111
111
+
return fmt.Sprintf("</%s>", tag)
102
112
}
103
113
}
104
114
}