diff --git a/html.go b/html.go
index 0b375bf..b5aacab 100644
--- a/html.go
+++ b/html.go
@@ -190,11 +190,11 @@ func entityEscapeWithSkip(out *bytes.Buffer, src []byte, skipRanges [][]int) {
attrEscape(out, src[end:])
}
-func (options *Html) GetFlags() HtmlFlags {
- return options.flags
+func (r *Html) GetFlags() HtmlFlags {
+ return r.flags
}
-func (options *Html) TitleBlock(out *bytes.Buffer, text []byte) {
+func (r *Html) TitleBlock(out *bytes.Buffer, text []byte) {
text = bytes.TrimPrefix(text, []byte("% "))
text = bytes.Replace(text, []byte("\n% "), []byte("\n"), -1)
out.WriteString("
")
@@ -202,22 +202,22 @@ func (options *Html) TitleBlock(out *bytes.Buffer, text []byte) {
out.WriteString("\n
")
}
-func (options *Html) BeginHeader(out *bytes.Buffer, level int, id string) int {
+func (r *Html) BeginHeader(out *bytes.Buffer, level int, id string) int {
doubleSpace(out)
- if id == "" && options.flags&Toc != 0 {
- id = fmt.Sprintf("toc_%d", options.headerCount)
+ if id == "" && r.flags&Toc != 0 {
+ id = fmt.Sprintf("toc_%d", r.headerCount)
}
if id != "" {
- id = options.ensureUniqueHeaderID(id)
+ id = r.ensureUniqueHeaderID(id)
- if options.parameters.HeaderIDPrefix != "" {
- id = options.parameters.HeaderIDPrefix + id
+ if r.parameters.HeaderIDPrefix != "" {
+ id = r.parameters.HeaderIDPrefix + id
}
- if options.parameters.HeaderIDSuffix != "" {
- id = id + options.parameters.HeaderIDSuffix
+ if r.parameters.HeaderIDSuffix != "" {
+ id = id + r.parameters.HeaderIDSuffix
}
out.WriteString(fmt.Sprintf("", level, id))
@@ -237,8 +237,8 @@ func (r *Html) EndHeader(out *bytes.Buffer, level int, id string, tocMarker int)
out.WriteString(fmt.Sprintf("\n", level))
}
-func (options *Html) BlockHtml(out *bytes.Buffer, text []byte) {
- if options.flags&SkipHTML != 0 {
+func (r *Html) BlockHtml(out *bytes.Buffer, text []byte) {
+ if r.flags&SkipHTML != 0 {
return
}
@@ -247,14 +247,14 @@ func (options *Html) BlockHtml(out *bytes.Buffer, text []byte) {
out.WriteByte('\n')
}
-func (options *Html) HRule(out *bytes.Buffer) {
+func (r *Html) HRule(out *bytes.Buffer) {
doubleSpace(out)
out.WriteString("
\n")
}
-func (options *Html) BlockQuote(out *bytes.Buffer, text []byte) {
+func (r *Html) BlockQuote(out *bytes.Buffer, text []byte) {
doubleSpace(out)
out.WriteString("\n")
out.Write(text)
out.WriteString("
\n")
}
-func (options *Html) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {
+func (r *Html) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {
doubleSpace(out)
out.WriteString("\n\n")
out.Write(header)
@@ -301,14 +301,14 @@ func (options *Html) Table(out *bytes.Buffer, header []byte, body []byte, column
out.WriteString("\n
\n")
}
-func (options *Html) TableRow(out *bytes.Buffer, text []byte) {
+func (r *Html) TableRow(out *bytes.Buffer, text []byte) {
doubleSpace(out)
out.WriteString("\n")
out.Write(text)
out.WriteString("\n
\n")
}
-func (options *Html) TableHeaderCell(out *bytes.Buffer, text []byte, align int) {
+func (r *Html) TableHeaderCell(out *bytes.Buffer, text []byte, align int) {
doubleSpace(out)
switch align {
case TableAlignmentLeft:
@@ -325,7 +325,7 @@ func (options *Html) TableHeaderCell(out *bytes.Buffer, text []byte, align int)
out.WriteString("")
}
-func (options *Html) TableCell(out *bytes.Buffer, text []byte, align int) {
+func (r *Html) TableCell(out *bytes.Buffer, text []byte, align int) {
doubleSpace(out)
switch align {
case TableAlignmentLeft:
@@ -342,10 +342,10 @@ func (options *Html) TableCell(out *bytes.Buffer, text []byte, align int) {
out.WriteString("")
}
-func (options *Html) BeginFootnotes(out *bytes.Buffer) {
+func (r *Html) BeginFootnotes(out *bytes.Buffer) {
out.WriteString("\n")
}
-func (options *Html) FootnoteItem(out *bytes.Buffer, name, text []byte, flags ListType) {
+func (r *Html) FootnoteItem(out *bytes.Buffer, name, text []byte, flags ListType) {
if flags&ListItemContainsBlock != 0 || flags&ListItemBeginningOfList != 0 {
doubleSpace(out)
}
slug := slugify(name)
out.WriteString(`\n")
}
-func (options *Html) BeginList(out *bytes.Buffer, flags ListType) {
+func (r *Html) BeginList(out *bytes.Buffer, flags ListType) {
doubleSpace(out)
if flags&ListTypeDefinition != 0 {
@@ -398,7 +398,7 @@ func (r *Html) EndList(out *bytes.Buffer, flags ListType) {
}
}
-func (options *Html) ListItem(out *bytes.Buffer, text []byte, flags ListType) {
+func (r *Html) ListItem(out *bytes.Buffer, text []byte, flags ListType) {
if (flags&ListItemContainsBlock != 0 && flags&ListTypeDefinition == 0) ||
flags&ListItemBeginningOfList != 0 {
doubleSpace(out)
@@ -429,9 +429,9 @@ func (r *Html) EndParagraph(out *bytes.Buffer) {
out.WriteString("\n")
}
-func (options *Html) AutoLink(out *bytes.Buffer, link []byte, kind LinkType) {
+func (r *Html) AutoLink(out *bytes.Buffer, link []byte, kind LinkType) {
skipRanges := htmlEntity.FindAllIndex(link, -1)
- if options.flags&Safelink != 0 && !isSafeLink(link) && kind != LinkTypeEmail {
+ if r.flags&Safelink != 0 && !isSafeLink(link) && kind != LinkTypeEmail {
// mark it but don't link it if it is not a safe link: no smartypants
out.WriteString("")
entityEscapeWithSkip(out, link, skipRanges)
@@ -443,16 +443,16 @@ func (options *Html) AutoLink(out *bytes.Buffer, link []byte, kind LinkType) {
if kind == LinkTypeEmail {
out.WriteString("mailto:")
} else {
- options.maybeWriteAbsolutePrefix(out, link)
+ r.maybeWriteAbsolutePrefix(out, link)
}
entityEscapeWithSkip(out, link, skipRanges)
var relAttrs []string
- if options.flags&NofollowLinks != 0 && !isRelativeLink(link) {
+ if r.flags&NofollowLinks != 0 && !isRelativeLink(link) {
relAttrs = append(relAttrs, "nofollow")
}
- if options.flags&NoreferrerLinks != 0 && !isRelativeLink(link) {
+ if r.flags&NoreferrerLinks != 0 && !isRelativeLink(link) {
relAttrs = append(relAttrs, "noreferrer")
}
if len(relAttrs) > 0 {
@@ -460,7 +460,7 @@ func (options *Html) AutoLink(out *bytes.Buffer, link []byte, kind LinkType) {
}
// blank target only add to external link
- if options.flags&HrefTargetBlank != 0 && !isRelativeLink(link) {
+ if r.flags&HrefTargetBlank != 0 && !isRelativeLink(link) {
out.WriteString("\" target=\"_blank")
}
@@ -481,19 +481,19 @@ func (options *Html) AutoLink(out *bytes.Buffer, link []byte, kind LinkType) {
out.WriteString("")
}
-func (options *Html) CodeSpan(out *bytes.Buffer, text []byte) {
+func (r *Html) CodeSpan(out *bytes.Buffer, text []byte) {
out.WriteString("")
attrEscape(out, text)
out.WriteString("")
}
-func (options *Html) DoubleEmphasis(out *bytes.Buffer, text []byte) {
+func (r *Html) DoubleEmphasis(out *bytes.Buffer, text []byte) {
out.WriteString("")
out.Write(text)
out.WriteString("")
}
-func (options *Html) Emphasis(out *bytes.Buffer, text []byte) {
+func (r *Html) Emphasis(out *bytes.Buffer, text []byte) {
if len(text) == 0 {
return
}
@@ -502,22 +502,22 @@ func (options *Html) Emphasis(out *bytes.Buffer, text []byte) {
out.WriteString("")
}
-func (options *Html) maybeWriteAbsolutePrefix(out *bytes.Buffer, link []byte) {
- if options.parameters.AbsolutePrefix != "" && isRelativeLink(link) && link[0] != '.' {
- out.WriteString(options.parameters.AbsolutePrefix)
+func (r *Html) maybeWriteAbsolutePrefix(out *bytes.Buffer, link []byte) {
+ if r.parameters.AbsolutePrefix != "" && isRelativeLink(link) && link[0] != '.' {
+ out.WriteString(r.parameters.AbsolutePrefix)
if link[0] != '/' {
out.WriteByte('/')
}
}
}
-func (options *Html) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
- if options.flags&SkipImages != 0 {
+func (r *Html) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
+ if r.flags&SkipImages != 0 {
return
}
out.WriteString("
0 {
@@ -529,17 +529,17 @@ func (options *Html) Image(out *bytes.Buffer, link []byte, title []byte, alt []b
}
out.WriteByte('"')
- out.WriteString(options.closeTag)
+ out.WriteString(r.closeTag)
}
-func (options *Html) LineBreak(out *bytes.Buffer) {
+func (r *Html) LineBreak(out *bytes.Buffer) {
out.WriteString("
")
attrEscape(out, content)
@@ -547,7 +547,7 @@ func (options *Html) Link(out *bytes.Buffer, link []byte, title []byte, content
return
}
- if options.flags&Safelink != 0 && !isSafeLink(link) {
+ if r.flags&Safelink != 0 && !isSafeLink(link) {
// write the link text out but don't link it, just mark it with typewriter font
out.WriteString("")
attrEscape(out, content)
@@ -556,17 +556,17 @@ func (options *Html) Link(out *bytes.Buffer, link []byte, title []byte, content
}
out.WriteString(" 0 {
out.WriteString("\" title=\"")
attrEscape(out, title)
}
var relAttrs []string
- if options.flags&NofollowLinks != 0 && !isRelativeLink(link) {
+ if r.flags&NofollowLinks != 0 && !isRelativeLink(link) {
relAttrs = append(relAttrs, "nofollow")
}
- if options.flags&NoreferrerLinks != 0 && !isRelativeLink(link) {
+ if r.flags&NoreferrerLinks != 0 && !isRelativeLink(link) {
relAttrs = append(relAttrs, "noreferrer")
}
if len(relAttrs) > 0 {
@@ -574,7 +574,7 @@ func (options *Html) Link(out *bytes.Buffer, link []byte, title []byte, content
}
// blank target only add to external link
- if options.flags&HrefTargetBlank != 0 && !isRelativeLink(link) {
+ if r.flags&HrefTargetBlank != 0 && !isRelativeLink(link) {
out.WriteString("\" target=\"_blank")
}
@@ -584,62 +584,62 @@ func (options *Html) Link(out *bytes.Buffer, link []byte, title []byte, content
return
}
-func (options *Html) RawHtmlTag(out *bytes.Buffer, text []byte) {
- if options.flags&SkipHTML != 0 {
+func (r *Html) RawHtmlTag(out *bytes.Buffer, text []byte) {
+ if r.flags&SkipHTML != 0 {
return
}
- if options.flags&SkipStyle != 0 && isHtmlTag(text, "style") {
+ if r.flags&SkipStyle != 0 && isHtmlTag(text, "style") {
return
}
- if options.flags&SkipLinks != 0 && isHtmlTag(text, "a") {
+ if r.flags&SkipLinks != 0 && isHtmlTag(text, "a") {
return
}
- if options.flags&SkipImages != 0 && isHtmlTag(text, "img") {
+ if r.flags&SkipImages != 0 && isHtmlTag(text, "img") {
return
}
out.Write(text)
}
-func (options *Html) TripleEmphasis(out *bytes.Buffer, text []byte) {
+func (r *Html) TripleEmphasis(out *bytes.Buffer, text []byte) {
out.WriteString("")
out.Write(text)
out.WriteString("")
}
-func (options *Html) StrikeThrough(out *bytes.Buffer, text []byte) {
+func (r *Html) StrikeThrough(out *bytes.Buffer, text []byte) {
out.WriteString("")
out.Write(text)
out.WriteString("")
}
-func (options *Html) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
+func (r *Html) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
slug := slugify(ref)
out.WriteString(``)
}
-func (options *Html) Entity(out *bytes.Buffer, entity []byte) {
+func (r *Html) Entity(out *bytes.Buffer, entity []byte) {
out.Write(entity)
}
-func (options *Html) NormalText(out *bytes.Buffer, text []byte) {
- if options.flags&UseSmartypants != 0 {
- options.Smartypants(out, text)
+func (r *Html) NormalText(out *bytes.Buffer, text []byte) {
+ if r.flags&UseSmartypants != 0 {
+ r.Smartypants(out, text)
} else {
attrEscape(out, text)
}
}
-func (options *Html) Smartypants(out *bytes.Buffer, text []byte) {
+func (r *Html) Smartypants(out *bytes.Buffer, text []byte) {
smrt := smartypantsData{false, false}
// first do normal entity escaping
@@ -649,7 +649,7 @@ func (options *Html) Smartypants(out *bytes.Buffer, text []byte) {
mark := 0
for i := 0; i < len(text); i++ {
- if action := options.smartypants[text[i]]; action != nil {
+ if action := r.smartypants[text[i]]; action != nil {
if i > mark {
out.Write(text[mark:i])
}
@@ -668,13 +668,13 @@ func (options *Html) Smartypants(out *bytes.Buffer, text []byte) {
}
}
-func (options *Html) DocumentHeader(out *bytes.Buffer) {
- if options.flags&CompletePage == 0 {
+func (r *Html) DocumentHeader(out *bytes.Buffer) {
+ if r.flags&CompletePage == 0 {
return
}
ending := ""
- if options.flags&UseXHTML != 0 {
+ if r.flags&UseXHTML != 0 {
out.WriteString("\n")
out.WriteString("\n")
@@ -685,7 +685,7 @@ func (options *Html) DocumentHeader(out *bytes.Buffer) {
}
out.WriteString("\n")
out.WriteString(" ")
- options.NormalText(out, []byte(options.title))
+ r.NormalText(out, []byte(r.title))
out.WriteString("\n")
out.WriteString(" \n")
- if options.css != "" {
+ if r.css != "" {
out.WriteString(" \n")
@@ -705,104 +705,104 @@ func (options *Html) DocumentHeader(out *bytes.Buffer) {
out.WriteString("\n")
out.WriteString("\n")
- options.tocMarker = out.Len()
+ r.tocMarker = out.Len()
}
-func (options *Html) DocumentFooter(out *bytes.Buffer) {
+func (r *Html) DocumentFooter(out *bytes.Buffer) {
// finalize and insert the table of contents
- if options.flags&Toc != 0 {
- options.TocFinalize()
+ if r.flags&Toc != 0 {
+ r.TocFinalize()
// now we have to insert the table of contents into the document
var temp bytes.Buffer
// start by making a copy of everything after the document header
- temp.Write(out.Bytes()[options.tocMarker:])
+ temp.Write(out.Bytes()[r.tocMarker:])
// now clear the copied material from the main output buffer
- out.Truncate(options.tocMarker)
+ out.Truncate(r.tocMarker)
// corner case spacing issue
- if options.flags&CompletePage != 0 {
+ if r.flags&CompletePage != 0 {
out.WriteByte('\n')
}
// insert the table of contents
out.WriteString("\n")
// corner case spacing issue
- if options.flags&CompletePage == 0 && options.flags&OmitContents == 0 {
+ if r.flags&CompletePage == 0 && r.flags&OmitContents == 0 {
out.WriteByte('\n')
}
// write out everything that came after it
- if options.flags&OmitContents == 0 {
+ if r.flags&OmitContents == 0 {
out.Write(temp.Bytes())
}
}
- if options.flags&CompletePage != 0 {
+ if r.flags&CompletePage != 0 {
out.WriteString("\n\n")
out.WriteString("\n")
}
}
-func (options *Html) TocHeaderWithAnchor(text []byte, level int, anchor string) {
- for level > options.currentLevel {
+func (r *Html) TocHeaderWithAnchor(text []byte, level int, anchor string) {
+ for level > r.currentLevel {
switch {
- case bytes.HasSuffix(options.toc.Bytes(), []byte("\n")):
+ case bytes.HasSuffix(r.toc.Bytes(), []byte("\n")):
// this sublist can nest underneath a header
- size := options.toc.Len()
- options.toc.Truncate(size - len("\n"))
+ size := r.toc.Len()
+ r.toc.Truncate(size - len("\n"))
- case options.currentLevel > 0:
- options.toc.WriteString("")
+ case r.currentLevel > 0:
+ r.toc.WriteString("")
}
- if options.toc.Len() > 0 {
- options.toc.WriteByte('\n')
+ if r.toc.Len() > 0 {
+ r.toc.WriteByte('\n')
}
- options.toc.WriteString("\n")
- options.currentLevel++
+ r.toc.WriteString("\n")
+ r.currentLevel++
}
- for level < options.currentLevel {
- options.toc.WriteString("
")
- if options.currentLevel > 1 {
- options.toc.WriteString("
\n")
+ for level < r.currentLevel {
+ r.toc.WriteString("")
+ if r.currentLevel > 1 {
+ r.toc.WriteString("\n")
}
- options.currentLevel--
+ r.currentLevel--
}
- options.toc.WriteString("")
- options.headerCount++
+ r.toc.WriteString("\">")
+ r.headerCount++
- options.toc.Write(text)
+ r.toc.Write(text)
- options.toc.WriteString("\n")
+ r.toc.WriteString("\n")
}
-func (options *Html) TocHeader(text []byte, level int) {
- options.TocHeaderWithAnchor(text, level, "")
+func (r *Html) TocHeader(text []byte, level int) {
+ r.TocHeaderWithAnchor(text, level, "")
}
-func (options *Html) TocFinalize() {
- for options.currentLevel > 1 {
- options.toc.WriteString("\n")
- options.currentLevel--
+func (r *Html) TocFinalize() {
+ for r.currentLevel > 1 {
+ r.toc.WriteString("\n")
+ r.currentLevel--
}
- if options.currentLevel > 0 {
- options.toc.WriteString("\n")
+ if r.currentLevel > 0 {
+ r.toc.WriteString("\n")
}
}
@@ -928,20 +928,20 @@ func isRelativeLink(link []byte) (yes bool) {
return false
}
-func (options *Html) ensureUniqueHeaderID(id string) string {
- for count, found := options.headerIDs[id]; found; count, found = options.headerIDs[id] {
+func (r *Html) ensureUniqueHeaderID(id string) string {
+ for count, found := r.headerIDs[id]; found; count, found = r.headerIDs[id] {
tmp := fmt.Sprintf("%s-%d", id, count+1)
- if _, tmpFound := options.headerIDs[tmp]; !tmpFound {
- options.headerIDs[id] = count + 1
+ if _, tmpFound := r.headerIDs[tmp]; !tmpFound {
+ r.headerIDs[id] = count + 1
id = tmp
} else {
id = id + "-1"
}
}
- if _, found := options.headerIDs[id]; !found {
- options.headerIDs[id] = 0
+ if _, found := r.headerIDs[id]; !found {
+ r.headerIDs[id] = 0
}
return id
diff --git a/latex.go b/latex.go
index 7f92903..4abd334 100644
--- a/latex.go
+++ b/latex.go
@@ -34,12 +34,12 @@ func LatexRenderer(flags int) Renderer {
return &Latex{}
}
-func (options *Latex) GetFlags() HtmlFlags {
+func (r *Latex) GetFlags() HtmlFlags {
return 0
}
// render code chunks using verbatim, or listings if we have a language
-func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, lang string) {
+func (r *Latex) BlockCode(out *bytes.Buffer, text []byte, lang string) {
if lang == "" {
out.WriteString("\n\\begin{verbatim}\n")
} else {
@@ -55,17 +55,17 @@ func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, lang string) {
}
}
-func (options *Latex) TitleBlock(out *bytes.Buffer, text []byte) {
+func (r *Latex) TitleBlock(out *bytes.Buffer, text []byte) {
}
-func (options *Latex) BlockQuote(out *bytes.Buffer, text []byte) {
+func (r *Latex) BlockQuote(out *bytes.Buffer, text []byte) {
out.WriteString("\n\\begin{quotation}\n")
out.Write(text)
out.WriteString("\n\\end{quotation}\n")
}
-func (options *Latex) BlockHtml(out *bytes.Buffer, text []byte) {
+func (r *Latex) BlockHtml(out *bytes.Buffer, text []byte) {
// a pretty lame thing to do...
out.WriteString("\n\\begin{verbatim}\n")
out.Write(text)
@@ -94,7 +94,7 @@ func (r *Latex) EndHeader(out *bytes.Buffer, level int, id string, tocMarker int
out.WriteString("}\n")
}
-func (options *Latex) HRule(out *bytes.Buffer) {
+func (r *Latex) HRule(out *bytes.Buffer) {
out.WriteString("\n\\HRule\n")
}
@@ -114,7 +114,7 @@ func (r *Latex) EndList(out *bytes.Buffer, flags ListType) {
}
}
-func (options *Latex) ListItem(out *bytes.Buffer, text []byte, flags ListType) {
+func (r *Latex) ListItem(out *bytes.Buffer, text []byte, flags ListType) {
out.WriteString("\n\\item ")
out.Write(text)
}
@@ -127,7 +127,7 @@ func (r *Latex) EndParagraph(out *bytes.Buffer) {
out.WriteString("\n")
}
-func (options *Latex) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {
+func (r *Latex) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {
out.WriteString("\n\\begin{tabular}{")
for _, elt := range columnData {
switch elt {
@@ -146,21 +146,21 @@ func (options *Latex) Table(out *bytes.Buffer, header []byte, body []byte, colum
out.WriteString("\n\\end{tabular}\n")
}
-func (options *Latex) TableRow(out *bytes.Buffer, text []byte) {
+func (r *Latex) TableRow(out *bytes.Buffer, text []byte) {
if out.Len() > 0 {
out.WriteString(" \\\\\n")
}
out.Write(text)
}
-func (options *Latex) TableHeaderCell(out *bytes.Buffer, text []byte, align int) {
+func (r *Latex) TableHeaderCell(out *bytes.Buffer, text []byte, align int) {
if out.Len() > 0 {
out.WriteString(" & ")
}
out.Write(text)
}
-func (options *Latex) TableCell(out *bytes.Buffer, text []byte, align int) {
+func (r *Latex) TableCell(out *bytes.Buffer, text []byte, align int) {
if out.Len() > 0 {
out.WriteString(" & ")
}
@@ -175,11 +175,11 @@ func (r *Latex) BeginFootnotes(out *bytes.Buffer) {
func (r *Latex) EndFootnotes(out *bytes.Buffer) {
}
-func (options *Latex) FootnoteItem(out *bytes.Buffer, name, text []byte, flags ListType) {
+func (r *Latex) FootnoteItem(out *bytes.Buffer, name, text []byte, flags ListType) {
}
-func (options *Latex) AutoLink(out *bytes.Buffer, link []byte, kind LinkType) {
+func (r *Latex) AutoLink(out *bytes.Buffer, link []byte, kind LinkType) {
out.WriteString("\\href{")
if kind == LinkTypeEmail {
out.WriteString("mailto:")
@@ -190,25 +190,25 @@ func (options *Latex) AutoLink(out *bytes.Buffer, link []byte, kind LinkType) {
out.WriteString("}")
}
-func (options *Latex) CodeSpan(out *bytes.Buffer, text []byte) {
+func (r *Latex) CodeSpan(out *bytes.Buffer, text []byte) {
out.WriteString("\\texttt{")
escapeSpecialChars(out, text)
out.WriteString("}")
}
-func (options *Latex) DoubleEmphasis(out *bytes.Buffer, text []byte) {
+func (r *Latex) DoubleEmphasis(out *bytes.Buffer, text []byte) {
out.WriteString("\\textbf{")
out.Write(text)
out.WriteString("}")
}
-func (options *Latex) Emphasis(out *bytes.Buffer, text []byte) {
+func (r *Latex) Emphasis(out *bytes.Buffer, text []byte) {
out.WriteString("\\textit{")
out.Write(text)
out.WriteString("}")
}
-func (options *Latex) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
+func (r *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{")
@@ -223,11 +223,11 @@ func (options *Latex) Image(out *bytes.Buffer, link []byte, title []byte, alt []
}
}
-func (options *Latex) LineBreak(out *bytes.Buffer) {
+func (r *Latex) LineBreak(out *bytes.Buffer) {
out.WriteString(" \\\\\n")
}
-func (options *Latex) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
+func (r *Latex) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
out.WriteString("\\href{")
out.Write(link)
out.WriteString("}{")
@@ -235,23 +235,23 @@ func (options *Latex) Link(out *bytes.Buffer, link []byte, title []byte, content
out.WriteString("}")
}
-func (options *Latex) RawHtmlTag(out *bytes.Buffer, tag []byte) {
+func (r *Latex) RawHtmlTag(out *bytes.Buffer, tag []byte) {
}
-func (options *Latex) TripleEmphasis(out *bytes.Buffer, text []byte) {
+func (r *Latex) TripleEmphasis(out *bytes.Buffer, text []byte) {
out.WriteString("\\textbf{\\textit{")
out.Write(text)
out.WriteString("}}")
}
-func (options *Latex) StrikeThrough(out *bytes.Buffer, text []byte) {
+func (r *Latex) StrikeThrough(out *bytes.Buffer, text []byte) {
out.WriteString("\\sout{")
out.Write(text)
out.WriteString("}")
}
// TODO: this
-func (options *Latex) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
+func (r *Latex) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
}
@@ -285,17 +285,17 @@ func escapeSpecialChars(out *bytes.Buffer, text []byte) {
}
}
-func (options *Latex) Entity(out *bytes.Buffer, entity []byte) {
+func (r *Latex) Entity(out *bytes.Buffer, entity []byte) {
// TODO: convert this into a unicode character or something
out.Write(entity)
}
-func (options *Latex) NormalText(out *bytes.Buffer, text []byte) {
+func (r *Latex) NormalText(out *bytes.Buffer, text []byte) {
escapeSpecialChars(out, text)
}
// header and footer
-func (options *Latex) DocumentHeader(out *bytes.Buffer) {
+func (r *Latex) DocumentHeader(out *bytes.Buffer) {
out.WriteString("\\documentclass{article}\n")
out.WriteString("\n")
out.WriteString("\\usepackage{graphicx}\n")
@@ -324,6 +324,6 @@ func (options *Latex) DocumentHeader(out *bytes.Buffer) {
out.WriteString("\\begin{document}\n")
}
-func (options *Latex) DocumentFooter(out *bytes.Buffer) {
+func (r *Latex) DocumentFooter(out *bytes.Buffer) {
out.WriteString("\n\\end{document}\n")
}