From 45820516bb308c5fdc7a7efba124057164a5a071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Wed, 2 Aug 2017 09:20:10 +0300 Subject: [PATCH] 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 --- html.go | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/html.go b/html.go index f1a60de2..6e9f35c0 100644 --- a/html.go +++ b/html.go @@ -45,27 +45,29 @@ const ( 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 = "]" - HTMLComment = "|" - ProcessingInstruction = "[<][?].*?[?][>]" - Declaration = "]*>" - CDATA = "" - 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 = "]" + 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 = "" + declaration = "]*>" + doubleQuotedValue = "\"[^\"]*\"" + htmlComment = "|" + processingInstruction = "[<][?].*?[?][>]" + singleQuotedValue = "'[^']*'" + tagName = "[A-Za-z][A-Za-z0-9-]*" + unquotedValue = "[^\"'=<>`\\x00-\\x20]+" ) // HTMLRendererParameters is a collection of supplementary parameters tweaking