Use more idiomatic form for set of strings. This is a better style for a set, since each value can only be present or absent. With bool as value type, each value may be absent, or true or false. It also uses slightly more memory.
Dmitri Shuralyov shurcooL@gmail.com
Mon, 09 Nov 2015 21:18:55 -0800
2 files changed,
41 insertions(+),
41 deletions(-)
M
markdown.go
→
markdown.go
@@ -102,49 +102,49 @@ TAB_SIZE_DEFAULT = 4
TAB_SIZE_EIGHT = 8 ) -// These are the tags that are recognized as HTML block tags. +// blockTags is a set of tags that are recognized as HTML block tags. // Any of these can be included in markdown text without special escaping. -var blockTags = map[string]bool{ - "blockquote": true, - "del": true, - "div": true, - "dl": true, - "fieldset": true, - "form": true, - "h1": true, - "h2": true, - "h3": true, - "h4": true, - "h5": true, - "h6": true, - "iframe": true, - "ins": true, - "math": true, - "noscript": true, - "ol": true, - "pre": true, - "p": true, - "script": true, - "style": true, - "table": true, - "ul": true, +var blockTags = map[string]struct{}{ + "blockquote": struct{}{}, + "del": struct{}{}, + "div": struct{}{}, + "dl": struct{}{}, + "fieldset": struct{}{}, + "form": struct{}{}, + "h1": struct{}{}, + "h2": struct{}{}, + "h3": struct{}{}, + "h4": struct{}{}, + "h5": struct{}{}, + "h6": struct{}{}, + "iframe": struct{}{}, + "ins": struct{}{}, + "math": struct{}{}, + "noscript": struct{}{}, + "ol": struct{}{}, + "pre": struct{}{}, + "p": struct{}{}, + "script": struct{}{}, + "style": struct{}{}, + "table": struct{}{}, + "ul": struct{}{}, // HTML5 - "address": true, - "article": true, - "aside": true, - "canvas": true, - "figcaption": true, - "figure": true, - "footer": true, - "header": true, - "hgroup": true, - "main": true, - "nav": true, - "output": true, - "progress": true, - "section": true, - "video": true, + "address": struct{}{}, + "article": struct{}{}, + "aside": struct{}{}, + "canvas": struct{}{}, + "figcaption": struct{}{}, + "figure": struct{}{}, + "footer": struct{}{}, + "header": struct{}{}, + "hgroup": struct{}{}, + "main": struct{}{}, + "nav": struct{}{}, + "output": struct{}{}, + "progress": struct{}{}, + "section": struct{}{}, + "video": struct{}{}, } // Renderer is the rendering interface.