Merge 3df9bbfdc1
into e96880f42b
commit
661e32c14a
17
html.go
17
html.go
|
@ -83,6 +83,13 @@ type Html struct {
|
|||
title string // document title
|
||||
css string // optional css file url (used with HTML_COMPLETE_PAGE)
|
||||
|
||||
// The optional 'meta' map holds additional meta tags to
|
||||
// place into the final document's header.
|
||||
// Format:
|
||||
// key: name="author"
|
||||
// val: foo barrington
|
||||
meta map[string]string
|
||||
|
||||
parameters HtmlRendererParameters
|
||||
|
||||
// table of contents data
|
||||
|
@ -132,6 +139,8 @@ func HtmlRendererWithParameters(flags int, title string,
|
|||
css: css,
|
||||
parameters: renderParameters,
|
||||
|
||||
meta: make(map[string]string),
|
||||
|
||||
headerCount: 0,
|
||||
currentLevel: 0,
|
||||
toc: new(bytes.Buffer),
|
||||
|
@ -692,6 +701,14 @@ func (options *Html) DocumentHeader(out *bytes.Buffer) {
|
|||
out.WriteString(" <meta charset=\"utf-8\"")
|
||||
out.WriteString(ending)
|
||||
out.WriteString(">\n")
|
||||
// plug the user-specified <meta.../> tags
|
||||
if len(options.meta) > 0 {
|
||||
for k, v := range options.meta {
|
||||
out.WriteString(" <meta " + k + " content=\"" + v + "\"")
|
||||
out.WriteString(ending)
|
||||
out.WriteString(">\n")
|
||||
}
|
||||
}
|
||||
if options.css != "" {
|
||||
out.WriteString(" <link rel=\"stylesheet\" type=\"text/css\" href=\"")
|
||||
attrEscape(out, []byte(options.css))
|
||||
|
|
Loading…
Reference in New Issue