summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/russross/blackfriday/latex.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/russross/blackfriday/latex.go')
-rw-r--r--vendor/github.com/russross/blackfriday/latex.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/vendor/github.com/russross/blackfriday/latex.go b/vendor/github.com/russross/blackfriday/latex.go
index 70705aa9c1..3d30d09474 100644
--- a/vendor/github.com/russross/blackfriday/latex.go
+++ b/vendor/github.com/russross/blackfriday/latex.go
@@ -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")