Rename HTML to HTMLRenderer
Vytautas Ĺ altenis vytas@rtfb.lt
Mon, 11 Apr 2016 11:45:40 +0300
1 files changed,
14 insertions(+),
14 deletions(-)
jump to
M
html.go
→
html.go
@@ -85,10 +85,10 @@ Flags HTMLFlags // Flags allow customizing this renderer's behavior
Extensions Extensions // Extensions give Smartypants and HTML renderer access to Blackfriday's global extensions } -// HTML is a type that implements the Renderer interface for HTML output. +// HTMLRenderer is a type that implements the Renderer interface for HTML output. // // Do not create this directly, instead use the NewHTMLRenderer function. -type HTML struct { +type HTMLRenderer struct { HTMLRendererParameters closeTag string // how to end singleton tags: either " />" or ">"@@ -122,7 +122,7 @@ func (w *HTMLWriter) Newline() {
w.WriteByte('\n') } -// NewHTMLRenderer creates and configures an HTML object, which +// NewHTMLRenderer creates and configures an HTMLRenderer object, which // satisfies the Renderer interface. func NewHTMLRenderer(params HTMLRendererParameters) Renderer { // configure the rendering engine@@ -136,7 +136,7 @@ params.FootnoteReturnLinkContents = `<sup>[return]</sup>`
} var writer HTMLWriter - return &HTML{ + return &HTMLRenderer{ HTMLRendererParameters: params, closeTag: closeTag,@@ -165,7 +165,7 @@ }
return "", false } -func (r *HTML) attrEscape(src []byte) { +func (r *HTMLRenderer) attrEscape(src []byte) { org := 0 for i, ch := range src { if entity, ok := escapeSingleChar(ch); ok {@@ -189,7 +189,7 @@ esc2 := bytes.Replace(esc1, []byte("""), []byte("""), -1)
return bytes.Replace(esc2, []byte("'"), []byte{'\''}, -1) } -func (r *HTML) entityEscapeWithSkip(src []byte, skipRanges [][]int) { +func (r *HTMLRenderer) entityEscapeWithSkip(src []byte, skipRanges [][]int) { end := 0 for _, rang := range skipRanges { r.attrEscape(src[end:rang[0]])@@ -315,7 +315,7 @@
return false } -func (r *HTML) ensureUniqueHeaderID(id string) string { +func (r *HTMLRenderer) ensureUniqueHeaderID(id string) string { for count, found := r.headerIDs[id]; found; count, found = r.headerIDs[id] { tmp := fmt.Sprintf("%s-%d", id, count+1)@@ -334,7 +334,7 @@
return id } -func (r *HTML) addAbsPrefix(link []byte) []byte { +func (r *HTMLRenderer) addAbsPrefix(link []byte) []byte { if r.AbsolutePrefix != "" && isRelativeLink(link) && link[0] != '.' { newDest := r.AbsolutePrefix if link[0] != '/' {@@ -457,7 +457,7 @@ e2 := bytes.Replace(e1, []byte("""), []byte("""), -1)
return bytes.Replace(e2, []byte("'"), []byte{'\''}, -1) } -func (r *HTML) out(w io.Writer, text []byte) { +func (r *HTMLRenderer) out(w io.Writer, text []byte) { if r.disableTags > 0 { w.Write(htmlTagRe.ReplaceAll(text, []byte{})) } else {@@ -466,13 +466,13 @@ }
r.lastOutputLen = len(text) } -func (r *HTML) cr(w io.Writer) { +func (r *HTMLRenderer) cr(w io.Writer) { if r.lastOutputLen > 0 { r.out(w, []byte{'\n'}) } } -func (r *HTML) RenderNode(w io.Writer, node *Node, entering bool) WalkStatus { +func (r *HTMLRenderer) RenderNode(w io.Writer, node *Node, entering bool) WalkStatus { attrs := []string{} switch node.Type { case Text:@@ -779,7 +779,7 @@ }
return GoToNext } -func (r *HTML) writeDocumentHeader(w *bytes.Buffer, sr *SPRenderer) { +func (r *HTMLRenderer) writeDocumentHeader(w *bytes.Buffer, sr *SPRenderer) { if r.Flags&CompletePage == 0 { return }@@ -820,14 +820,14 @@ w.WriteString("</head>\n")
w.WriteString("<body>\n\n") } -func (r *HTML) writeDocumentFooter(w *bytes.Buffer) { +func (r *HTMLRenderer) writeDocumentFooter(w *bytes.Buffer) { if r.Flags&CompletePage == 0 { return } w.WriteString("\n</body>\n</html>\n") } -func (r *HTML) Render(ast *Node) []byte { +func (r *HTMLRenderer) Render(ast *Node) []byte { //println("render_Blackfriday") //dump(ast) // Run Smartypants if it's enabled or simply escape text if not