diff --git a/html.go b/html.go index b2d9314..2390e32 100644 --- a/html.go +++ b/html.go @@ -374,12 +374,12 @@ func (options *Html) Paragraph(out *bytes.Buffer, text func() bool) { out.WriteString("
\n") } -func (options *Html) AutoLink(out *bytes.Buffer, link []byte, kind int) bool { +func (options *Html) AutoLink(out *bytes.Buffer, link []byte, kind int) { if len(link) == 0 { - return false + return } if options.flags&HTML_SAFELINK != 0 && !isSafeLink(link) && kind != LINK_TYPE_EMAIL { - return false + return } out.WriteString("") - - return true } -func (options *Html) CodeSpan(out *bytes.Buffer, text []byte) bool { +func (options *Html) CodeSpan(out *bytes.Buffer, text []byte) { out.WriteString("")
attrEscape(out, text)
out.WriteString("
")
- return true
}
-func (options *Html) DoubleEmphasis(out *bytes.Buffer, text []byte) bool {
+func (options *Html) DoubleEmphasis(out *bytes.Buffer, text []byte) {
if len(text) == 0 {
- return false
+ return
}
out.WriteString("")
out.Write(text)
out.WriteString("")
- return true
}
-func (options *Html) Emphasis(out *bytes.Buffer, text []byte) bool {
+func (options *Html) Emphasis(out *bytes.Buffer, text []byte) {
if len(text) == 0 {
- return false
+ return
}
out.WriteString("")
out.Write(text)
out.WriteString("")
- return true
}
-func (options *Html) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) bool {
+func (options *Html) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
if options.flags&HTML_SKIP_IMAGES != 0 {
- return false
+ return
}
if len(link) == 0 {
- return false
+ return
}
out.WriteString("")
out.Write(content)
out.WriteString("")
- return true
+ return
}
-func (options *Html) RawHtmlTag(out *bytes.Buffer, text []byte) bool {
+func (options *Html) RawHtmlTag(out *bytes.Buffer, text []byte) {
if options.flags&HTML_SKIP_HTML != 0 {
- return true
+ return
}
if options.flags&HTML_SKIP_STYLE != 0 && isHtmlTag(text, "style") {
- return true
+ return
}
if options.flags&HTML_SKIP_LINKS != 0 && isHtmlTag(text, "a") {
- return true
+ return
}
if options.flags&HTML_SKIP_IMAGES != 0 && isHtmlTag(text, "img") {
- return true
+ return
}
out.Write(text)
- return true
}
-func (options *Html) TripleEmphasis(out *bytes.Buffer, text []byte) bool {
+func (options *Html) TripleEmphasis(out *bytes.Buffer, text []byte) {
if len(text) == 0 {
- return false
+ return
}
out.WriteString("")
out.Write(text)
out.WriteString("")
- return true
}
-func (options *Html) StrikeThrough(out *bytes.Buffer, text []byte) bool {
+func (options *Html) StrikeThrough(out *bytes.Buffer, text []byte) {
if len(text) == 0 {
- return false
+ return
}
out.WriteString("[foo]()
\n", "![foo](/bar/)\n", "\n
\n", @@ -294,7 +294,7 @@ func TestInlineLink(t *testing.T) { "\n
\n", "![foo]()\n", - "[foo]()
\n", + "![foo]()
\n", "[a link]\t(/with_a_tab/)\n", "\n", diff --git a/latex.go b/latex.go index 7739746..45cf755 100644 --- a/latex.go +++ b/latex.go @@ -151,7 +151,7 @@ func (options *Latex) TableCell(out *bytes.Buffer, text []byte, align int) { out.Write(text) } -func (options *Latex) AutoLink(out *bytes.Buffer, link []byte, kind int) bool { +func (options *Latex) AutoLink(out *bytes.Buffer, link []byte, kind int) { out.WriteString("\\href{") if kind == LINK_TYPE_EMAIL { out.WriteString("mailto:") @@ -160,31 +160,27 @@ func (options *Latex) AutoLink(out *bytes.Buffer, link []byte, kind int) bool { out.WriteString("}{") out.Write(link) out.WriteString("}") - return true } -func (options *Latex) CodeSpan(out *bytes.Buffer, text []byte) bool { +func (options *Latex) CodeSpan(out *bytes.Buffer, text []byte) { out.WriteString("\\texttt{") escapeSpecialChars(out, text) out.WriteString("}") - return true } -func (options *Latex) DoubleEmphasis(out *bytes.Buffer, text []byte) bool { +func (options *Latex) DoubleEmphasis(out *bytes.Buffer, text []byte) { out.WriteString("\\textbf{") out.Write(text) out.WriteString("}") - return true } -func (options *Latex) Emphasis(out *bytes.Buffer, text []byte) bool { +func (options *Latex) Emphasis(out *bytes.Buffer, text []byte) { out.WriteString("\\textit{") out.Write(text) out.WriteString("}") - return true } -func (options *Latex) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) bool { +func (options *Latex) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) { if bytes.HasPrefix(link, []byte("http://")) || bytes.HasPrefix(link, []byte("https://")) { // treat it like a link out.WriteString("\\href{") @@ -197,39 +193,33 @@ func (options *Latex) Image(out *bytes.Buffer, link []byte, title []byte, alt [] out.Write(link) out.WriteString("}") } - return true } -func (options *Latex) LineBreak(out *bytes.Buffer) bool { +func (options *Latex) LineBreak(out *bytes.Buffer) { out.WriteString(" \\\\\n") - return true } -func (options *Latex) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) bool { +func (options *Latex) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { out.WriteString("\\href{") out.Write(link) out.WriteString("}{") out.Write(content) out.WriteString("}") - return true } -func (options *Latex) RawHtmlTag(out *bytes.Buffer, tag []byte) bool { - return true +func (options *Latex) RawHtmlTag(out *bytes.Buffer, tag []byte) { } -func (options *Latex) TripleEmphasis(out *bytes.Buffer, text []byte) bool { +func (options *Latex) TripleEmphasis(out *bytes.Buffer, text []byte) { out.WriteString("\\textbf{\\textit{") out.Write(text) out.WriteString("}}") - return true } -func (options *Latex) StrikeThrough(out *bytes.Buffer, text []byte) bool { +func (options *Latex) StrikeThrough(out *bytes.Buffer, text []byte) { out.WriteString("\\sout{") out.Write(text) out.WriteString("}") - return true } func needsBackslash(c byte) bool { diff --git a/markdown.go b/markdown.go index 2041f3b..754d010 100644 --- a/markdown.go +++ b/markdown.go @@ -114,17 +114,17 @@ type Renderer interface { TableRow(out *bytes.Buffer, text []byte) TableCell(out *bytes.Buffer, text []byte, flags int) - // Span-level callbacks---return false prints the span verbatim - AutoLink(out *bytes.Buffer, link []byte, kind int) bool - CodeSpan(out *bytes.Buffer, text []byte) bool - DoubleEmphasis(out *bytes.Buffer, text []byte) bool - Emphasis(out *bytes.Buffer, text []byte) bool - Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) bool - LineBreak(out *bytes.Buffer) bool - Link(out *bytes.Buffer, link []byte, title []byte, content []byte) bool - RawHtmlTag(out *bytes.Buffer, tag []byte) bool - TripleEmphasis(out *bytes.Buffer, text []byte) bool - StrikeThrough(out *bytes.Buffer, text []byte) bool + // Span-level callbacks + AutoLink(out *bytes.Buffer, link []byte, kind int) + CodeSpan(out *bytes.Buffer, text []byte) + DoubleEmphasis(out *bytes.Buffer, text []byte) + Emphasis(out *bytes.Buffer, text []byte) + Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) + LineBreak(out *bytes.Buffer) + Link(out *bytes.Buffer, link []byte, title []byte, content []byte) + RawHtmlTag(out *bytes.Buffer, tag []byte) + TripleEmphasis(out *bytes.Buffer, text []byte) + StrikeThrough(out *bytes.Buffer, text []byte) // Low-level callbacks Entity(out *bytes.Buffer, entity []byte) diff --git a/upskirtref/Links, inline style.html b/upskirtref/Links, inline style.html index f36607d..5802f2d 100644 --- a/upskirtref/Links, inline style.html +++ b/upskirtref/Links, inline style.html @@ -8,4 +8,4 @@ - +[Empty]().