Skip to content

Commit 4582051

Browse files
authored
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
1 parent e0df702 commit 4582051

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

html.go

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,29 @@ const (
4545
SmartypantsLatexDashes // Enable LaTeX-style dashes (with Smartypants)
4646
SmartypantsAngledQuotes // Enable angled double quotes (with Smartypants) for double quotes rendering
4747
TOC // Generate a table of contents
48-
49-
TagName = "[A-Za-z][A-Za-z0-9-]*"
50-
AttributeName = "[a-zA-Z_:][a-zA-Z0-9:._-]*"
51-
UnquotedValue = "[^\"'=<>`\\x00-\\x20]+"
52-
SingleQuotedValue = "'[^']*'"
53-
DoubleQuotedValue = "\"[^\"]*\""
54-
AttributeValue = "(?:" + UnquotedValue + "|" + SingleQuotedValue + "|" + DoubleQuotedValue + ")"
55-
AttributeValueSpec = "(?:" + "\\s*=" + "\\s*" + AttributeValue + ")"
56-
Attribute = "(?:" + "\\s+" + AttributeName + AttributeValueSpec + "?)"
57-
OpenTag = "<" + TagName + Attribute + "*" + "\\s*/?>"
58-
CloseTag = "</" + TagName + "\\s*[>]"
59-
HTMLComment = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->"
60-
ProcessingInstruction = "[<][?].*?[?][>]"
61-
Declaration = "<![A-Z]+" + "\\s+[^>]*>"
62-
CDATA = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
63-
HTMLTag = "(?:" + OpenTag + "|" + CloseTag + "|" + HTMLComment + "|" +
64-
ProcessingInstruction + "|" + Declaration + "|" + CDATA + ")"
6548
)
6649

6750
var (
68-
htmlTagRe = regexp.MustCompile("(?i)^" + HTMLTag)
51+
htmlTagRe = regexp.MustCompile("(?i)^" + htmlTag)
52+
)
53+
54+
const (
55+
htmlTag = "(?:" + openTag + "|" + closeTag + "|" + htmlComment + "|" +
56+
processingInstruction + "|" + declaration + "|" + cdata + ")"
57+
closeTag = "</" + tagName + "\\s*[>]"
58+
openTag = "<" + tagName + attribute + "*" + "\\s*/?>"
59+
attribute = "(?:" + "\\s+" + attributeName + attributeValueSpec + "?)"
60+
attributeValue = "(?:" + unquotedValue + "|" + singleQuotedValue + "|" + doubleQuotedValue + ")"
61+
attributeValueSpec = "(?:" + "\\s*=" + "\\s*" + attributeValue + ")"
62+
attributeName = "[a-zA-Z_:][a-zA-Z0-9:._-]*"
63+
cdata = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
64+
declaration = "<![A-Z]+" + "\\s+[^>]*>"
65+
doubleQuotedValue = "\"[^\"]*\""
66+
htmlComment = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->"
67+
processingInstruction = "[<][?].*?[?][>]"
68+
singleQuotedValue = "'[^']*'"
69+
tagName = "[A-Za-z][A-Za-z0-9-]*"
70+
unquotedValue = "[^\"'=<>`\\x00-\\x20]+"
6971
)
7072

7173
// HTMLRendererParameters is a collection of supplementary parameters tweaking

0 commit comments

Comments
 (0)