Merge pull request #88 from dimfeld/master Remove unnecessary HTML_ABSOLUTE_LINKS flag
Vytautas Ĺ altenis vytas@rtfb.lt
Fri, 30 May 2014 10:30:05 +0300
2 files changed,
4 insertions(+),
5 deletions(-)
M
html.go
→
html.go
@@ -41,7 +41,6 @@ HTML_USE_XHTML // generate XHTML output instead of HTML
HTML_USE_SMARTYPANTS // enable smart punctuation substitutions HTML_SMARTYPANTS_FRACTIONS // enable smart fractions (with HTML_USE_SMARTYPANTS) HTML_SMARTYPANTS_LATEX_DASHES // enable LaTeX-style dashes (with HTML_USE_SMARTYPANTS) - HTML_ABSOLUTE_LINKS // convert all links to absolute links, using AbsolutePrefix HTML_FOOTNOTE_RETURN_LINKS // generate a link at the end of a footnote to return to the source )@@ -57,7 +56,7 @@ htmlEntity = regexp.MustCompile(`&[a-z]{2,5};`)
) type HtmlRendererParameters struct { - // Prepend this text to each URL, if the HTML_ABSOLUTE_LINKS option is enabled. + // Prepend this text to each relative URL. AbsolutePrefix string // Add this text to each footnote anchor, to ensure uniqueness. FootnoteAnchorPrefix string@@ -500,7 +499,7 @@ out.WriteString("</em>")
} func (options *Html) maybeWriteAbsolutePrefix(out *bytes.Buffer, link []byte) { - if options.flags&HTML_ABSOLUTE_LINKS != 0 && isRelativeLink(link) { + if options.parameters.AbsolutePrefix != "" && isRelativeLink(link) { out.WriteString(options.parameters.AbsolutePrefix) if link[0] != '/' { out.WriteByte('/')
M
inline_test.go
→
inline_test.go
@@ -41,7 +41,7 @@
prefix := "http://localhost" params := HtmlRendererParameters{AbsolutePrefix: prefix} transformTests := transformLinks(tests, prefix) - doTestsInlineParam(t, transformTests, 0, HTML_ABSOLUTE_LINKS, params) + doTestsInlineParam(t, transformTests, 0, 0, params) } func doSafeTestsInline(t *testing.T, tests []string) {@@ -52,7 +52,7 @@ // just rerun it with different parameters and the same expectations.
prefix := "http://localhost" params := HtmlRendererParameters{AbsolutePrefix: prefix} transformTests := transformLinks(tests, prefix) - doTestsInlineParam(t, transformTests, 0, HTML_SAFELINK|HTML_ABSOLUTE_LINKS, params) + doTestsInlineParam(t, transformTests, 0, HTML_SAFELINK, params) } func doTestsInlineParam(t *testing.T, tests []string, extensions, htmlFlags int,