From 5bf00efe39adb96234b8404b6cc381092767374b Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Thu, 29 May 2014 09:17:20 -0500 Subject: [PATCH] Remove unnecessary HTML_ABSOLUTE_LINKS flag --- html.go | 5 ++--- inline_test.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/html.go b/html.go index c96399c..acf2bb7 100644 --- a/html.go +++ b/html.go @@ -41,7 +41,6 @@ const ( 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 @@ var ( ) 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 @@ func (options *Html) Emphasis(out *bytes.Buffer, text []byte) { } 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('/') diff --git a/inline_test.go b/inline_test.go index 919377d..eab7698 100644 --- a/inline_test.go +++ b/inline_test.go @@ -41,7 +41,7 @@ func doLinkTestsInline(t *testing.T, tests []string) { 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 @@ func doSafeTestsInline(t *testing.T, tests []string) { 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,