1
0
Fork 0
forked from forgejo/forgejo

Update blackfriday dependency per #2994 (#3857)

Signed-off-by: PJ Eby <pje@telecommunity.com>
This commit is contained in:
PJ Eby 2018-04-29 01:07:36 -04:00 committed by Lunny Xiao
parent 76106ab080
commit fc36567ee1
9 changed files with 292 additions and 110 deletions

View file

@ -17,6 +17,7 @@ package blackfriday
import (
"bytes"
"strings"
)
// Latex is a type that implements the Renderer interface for LaTeX output.
@ -39,16 +40,17 @@ func (options *Latex) GetFlags() int {
}
// render code chunks using verbatim, or listings if we have a language
func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, lang string) {
if lang == "" {
func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, info string) {
if info == "" {
out.WriteString("\n\\begin{verbatim}\n")
} else {
lang := strings.Fields(info)[0]
out.WriteString("\n\\begin{lstlisting}[language=")
out.WriteString(lang)
out.WriteString("]\n")
}
out.Write(text)
if lang == "" {
if info == "" {
out.WriteString("\n\\end{verbatim}\n")
} else {
out.WriteString("\n\\end{lstlisting}\n")