all repos — grayfriday @ 45820516bb308c5fdc7a7efba124057164a5a071

blackfriday fork with a few changes

Unexport a bunch of constants private to HTML renderer (#381)

Unexport a bunch of constants private to HTML renderer

They were cluttering the documentation and are not useful otherwise.
Rearrange constants in descending dependencies order
Vytautas Ĺ altenis vytas@rtfb.lt
Wed, 02 Aug 2017 09:20:10 +0300
commit

45820516bb308c5fdc7a7efba124057164a5a071

parent

e0df70211230f75ef418655c3bfb721c37010345

1 files changed, 20 insertions(+), 18 deletions(-)

jump to
M html.gohtml.go

@@ -45,27 +45,29 @@ SmartypantsDashes // Enable smart dashes (with Smartypants)

SmartypantsLatexDashes // Enable LaTeX-style dashes (with Smartypants) SmartypantsAngledQuotes // Enable angled double quotes (with Smartypants) for double quotes rendering TOC // Generate a table of contents - - TagName = "[A-Za-z][A-Za-z0-9-]*" - AttributeName = "[a-zA-Z_:][a-zA-Z0-9:._-]*" - UnquotedValue = "[^\"'=<>`\\x00-\\x20]+" - SingleQuotedValue = "'[^']*'" - DoubleQuotedValue = "\"[^\"]*\"" - AttributeValue = "(?:" + UnquotedValue + "|" + SingleQuotedValue + "|" + DoubleQuotedValue + ")" - AttributeValueSpec = "(?:" + "\\s*=" + "\\s*" + AttributeValue + ")" - Attribute = "(?:" + "\\s+" + AttributeName + AttributeValueSpec + "?)" - OpenTag = "<" + TagName + Attribute + "*" + "\\s*/?>" - CloseTag = "</" + TagName + "\\s*[>]" - HTMLComment = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->" - ProcessingInstruction = "[<][?].*?[?][>]" - Declaration = "<![A-Z]+" + "\\s+[^>]*>" - CDATA = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>" - HTMLTag = "(?:" + OpenTag + "|" + CloseTag + "|" + HTMLComment + "|" + - ProcessingInstruction + "|" + Declaration + "|" + CDATA + ")" ) var ( - htmlTagRe = regexp.MustCompile("(?i)^" + HTMLTag) + htmlTagRe = regexp.MustCompile("(?i)^" + htmlTag) +) + +const ( + htmlTag = "(?:" + openTag + "|" + closeTag + "|" + htmlComment + "|" + + processingInstruction + "|" + declaration + "|" + cdata + ")" + closeTag = "</" + tagName + "\\s*[>]" + openTag = "<" + tagName + attribute + "*" + "\\s*/?>" + attribute = "(?:" + "\\s+" + attributeName + attributeValueSpec + "?)" + attributeValue = "(?:" + unquotedValue + "|" + singleQuotedValue + "|" + doubleQuotedValue + ")" + attributeValueSpec = "(?:" + "\\s*=" + "\\s*" + attributeValue + ")" + attributeName = "[a-zA-Z_:][a-zA-Z0-9:._-]*" + cdata = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>" + declaration = "<![A-Z]+" + "\\s+[^>]*>" + doubleQuotedValue = "\"[^\"]*\"" + htmlComment = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->" + processingInstruction = "[<][?].*?[?][>]" + singleQuotedValue = "'[^']*'" + tagName = "[A-Za-z][A-Za-z0-9-]*" + unquotedValue = "[^\"'=<>`\\x00-\\x20]+" ) // HTMLRendererParameters is a collection of supplementary parameters tweaking