all repos — grayfriday @ 427a14caf2d7988c34bf172c1822655fe7608444

blackfriday fork with a few changes

Convert silly funcs to consts
Vytautas Saltenis vytas@rtfb.lt
Mon, 22 Sep 2014 11:44:58 +0300
commit

427a14caf2d7988c34bf172c1822655fe7608444

parent

3a9946166285b0dbfe632f15d44191e7f9c0776c

2 files changed, 18 insertions(+), 24 deletions(-)

jump to
M inline_test.goinline_test.go

@@ -42,7 +42,7 @@ prefix := "http://localhost"

params := HtmlRendererParameters{AbsolutePrefix: prefix} transformTests := transformLinks(tests, prefix) doTestsInlineParam(t, transformTests, 0, 0, params) - doTestsInlineParam(t, transformTests, 0, commonHtmlFlags(), params) + doTestsInlineParam(t, transformTests, 0, commonHtmlFlags, params) } func doSafeTestsInline(t *testing.T, tests []string) {
M markdown.gomarkdown.go

@@ -41,6 +41,21 @@ EXTENSION_FOOTNOTES // Pandoc-style footnotes

EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK // No need to insert an empty line to start a (code, quote, order list, unorder list)block EXTENSION_HEADER_IDS // specify header IDs with {#id} EXTENSION_TITLEBLOCK // Titleblock ala pandoc + + commonHtmlFlags = 0 | + HTML_USE_XHTML | + HTML_USE_SMARTYPANTS | + HTML_SMARTYPANTS_FRACTIONS | + HTML_SMARTYPANTS_LATEX_DASHES + + commonExtensions = 0 | + EXTENSION_NO_INTRA_EMPHASIS | + EXTENSION_TABLES | + EXTENSION_FENCED_CODE | + EXTENSION_AUTOLINK | + EXTENSION_STRIKETHROUGH | + EXTENSION_SPACE_HEADERS | + EXTENSION_HEADER_IDS ) // These are the possible flag values for the link renderer.

@@ -212,27 +227,6 @@

return Markdown(input, renderer, extensions) } -func commonHtmlFlags() int { - htmlFlags := 0 - htmlFlags |= HTML_USE_XHTML - htmlFlags |= HTML_USE_SMARTYPANTS - htmlFlags |= HTML_SMARTYPANTS_FRACTIONS - htmlFlags |= HTML_SMARTYPANTS_LATEX_DASHES - return htmlFlags -} - -func commonExtensions() int { - extensions := 0 - extensions |= EXTENSION_NO_INTRA_EMPHASIS - extensions |= EXTENSION_TABLES - extensions |= EXTENSION_FENCED_CODE - extensions |= EXTENSION_AUTOLINK - extensions |= EXTENSION_STRIKETHROUGH - extensions |= EXTENSION_SPACE_HEADERS - extensions |= EXTENSION_HEADER_IDS - return extensions -} - // Call Markdown with most useful extensions enabled // MarkdownCommon is a convenience function for simple rendering. // It processes markdown input with common extensions enabled, including:

@@ -254,8 +248,8 @@ //

// * Custom Header IDs func MarkdownCommon(input []byte) []byte { // set up the HTML renderer - renderer := HtmlRenderer(commonHtmlFlags(), "", "") - return Markdown(input, renderer, commonExtensions()) + renderer := HtmlRenderer(commonHtmlFlags, "", "") + return Markdown(input, renderer, commonExtensions) } // Markdown is the main rendering function.