diff options
Diffstat (limited to 'vendor/github.com/russross/blackfriday/html.go')
-rw-r--r-- | vendor/github.com/russross/blackfriday/html.go | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/vendor/github.com/russross/blackfriday/html.go b/vendor/github.com/russross/blackfriday/html.go index 74e67ee82b..e0a6c69c96 100644 --- a/vendor/github.com/russross/blackfriday/html.go +++ b/vendor/github.com/russross/blackfriday/html.go @@ -42,6 +42,7 @@ const ( HTML_SMARTYPANTS_DASHES // enable smart dashes (with HTML_USE_SMARTYPANTS) HTML_SMARTYPANTS_LATEX_DASHES // enable LaTeX-style dashes (with HTML_USE_SMARTYPANTS and HTML_SMARTYPANTS_DASHES) HTML_SMARTYPANTS_ANGLED_QUOTES // enable angled double quotes (with HTML_USE_SMARTYPANTS) for double quotes rendering + HTML_SMARTYPANTS_QUOTES_NBSP // enable "French guillemets" (with HTML_USE_SMARTYPANTS) HTML_FOOTNOTE_RETURN_LINKS // generate a link at the end of a footnote to return to the source ) @@ -254,33 +255,21 @@ func (options *Html) HRule(out *bytes.Buffer) { out.WriteByte('\n') } -func (options *Html) BlockCode(out *bytes.Buffer, text []byte, lang string) { +func (options *Html) BlockCode(out *bytes.Buffer, text []byte, info string) { doubleSpace(out) - // parse out the language names/classes - count := 0 - for _, elt := range strings.Fields(lang) { - if elt[0] == '.' { - elt = elt[1:] - } - if len(elt) == 0 { - continue - } - if count == 0 { - out.WriteString("<pre><code class=\"language-") - } else { - out.WriteByte(' ') - } - attrEscape(out, []byte(elt)) - count++ + endOfLang := strings.IndexAny(info, "\t ") + if endOfLang < 0 { + endOfLang = len(info) } - - if count == 0 { + lang := info[:endOfLang] + if len(lang) == 0 || lang == "." { out.WriteString("<pre><code>") } else { + out.WriteString("<pre><code class=\"language-") + attrEscape(out, []byte(lang)) out.WriteString("\">") } - attrEscape(out, text) out.WriteString("</code></pre>\n") } @@ -619,7 +608,7 @@ func (options *Html) FootnoteRef(out *bytes.Buffer, ref []byte, id int) { out.WriteString(`fnref:`) out.WriteString(options.parameters.FootnoteAnchorPrefix) out.Write(slug) - out.WriteString(`"><a rel="footnote" href="#`) + out.WriteString(`"><a href="#`) out.WriteString(`fn:`) out.WriteString(options.parameters.FootnoteAnchorPrefix) out.Write(slug) |