diff --git a/display.go b/display.go index 0be946c..d068f5e 100644 --- a/display.go +++ b/display.go @@ -21,7 +21,8 @@ type Displayer interface { } func ParseDisplayer(cmd string) error { - attrRe := regexp.MustCompile(`attr\{([a-zA-Z\-]+)\}`) + // Ref: https://www.w3.org/TR/2012/WD-html5-20120329/syntax.html#syntax-attribute-name + attrRe := regexp.MustCompile(`attr\{([^\s"'>/=\p{Cc}]+)\}`) if cmd == "text{}" { pupDisplayer = TextDisplayer{} } else if cmd == "json{}" { diff --git a/tests/cmds.txt b/tests/cmds.txt index 0d756bf..c8e663b 100644 --- a/tests/cmds.txt +++ b/tests/cmds.txt @@ -32,6 +32,7 @@ td:empty .summary [class=summary] [class="summary"] +[keep:empty] #toc #toc li + a #toc li + a text{} diff --git a/tests/expected_output.txt b/tests/expected_output.txt index 0f9608a..2e2851e 100644 --- a/tests/expected_output.txt +++ b/tests/expected_output.txt @@ -10,12 +10,12 @@ a92e50c09cd56970625ac3b74efbddb83b2731bb table li 66950e746590d7f4e9cfe3d1adef42cd0addcf1d table li:last-of-type 0a37d612cd4c67a42bd147b1edc5a1128456b017 table a[title="The Practice of Programming"] 0d3918d54f868f13110262ffbb88cbb0b083057d table a[title="The Practice of Programming"] text{} -199188dc8f1522426a628e41d96264bffb8beb0f json{} +87f5da2293a986a4699c0fb6c136d5d5205df768 json{} 95ef88ded9dab22ee3206cca47b9c3a376274bda text{} e4f7358fbb7bb1748a296fa2a7e815fa7de0a08b .after-portlet da39a3ee5e6b4b0d3255bfef95601890afd80709 .after 8c3d99638ba48ab6487b76929ab796ca1b40adc7 .dtstart.updated -5b3020ba03fb43f7cdbcb3924546532b6ec9bd71 :empty +9ef12e8e33809b2bddeccf158dc6f6abb48be39a :empty 3406ca0f548d66a7351af5411ce945cf67a2f849 td:empty 30fff0af0b1209f216d6e9124e7396c0adfa0758 .navbox-list li:nth-child(1) a38e26949f047faab5ea7ba2acabff899349ce03 .navbox-list li:nth-child(2) @@ -27,11 +27,12 @@ d314e83b059bb876b0e5ee76aa92d54987961f9a .navbox-list li:nth-last-child(1) 0b20c98650efa5df39d380fea8d5b43f3a08cb66 .navbox-list li:nth-child(3n+1) 52e726f0993d2660f0fb3ea85156f6fbcc1cfeee .navbox-list li:nth-last-child(n+1) 972973fe1e8f63e4481c8641d6169c638a528a6e .navbox-list li:nth-last-child(3n+1) -6c45ee6bca361b8a9baee50a15f575fc6ac73adc :only-child +56e8ed51e02c09a487e5356b632db0c8822284e8 :only-child 44c99f6ad37b65dc0893cdcb1c60235d827ee73e .navbox-list li:only-child 641037814e358487d1938fc080e08f72a3846ef8 .summary 641037814e358487d1938fc080e08f72a3846ef8 [class=summary] 641037814e358487d1938fc080e08f72a3846ef8 [class="summary"] +8ebb34c81dd0095b7cbf5580ffb5415567e2c137 [keep:empty] 613bf65ac4042b6ee0a7a47f08732fdbe1b5b06b #toc da39a3ee5e6b4b0d3255bfef95601890afd80709 #toc li + a da39a3ee5e6b4b0d3255bfef95601890afd80709 #toc li + a text{} diff --git a/tests/index.html b/tests/index.html index ec35afe..cc3830f 100644 --- a/tests/index.html +++ b/tests/index.html @@ -115,7 +115,7 @@
Go, also commonly referred to as golang, is a programming language initially developed at Google[6] in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson.[2] It is a statically-typed language with syntax loosely derived from that of C, adding garbage collection, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library.
The language was announced in November 2009 and is now used in some of Google's production systems.[7] Go's "gc" compiler targets the Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Plan 9, and Microsoft Windows operating systems and the i386, amd64, and ARM processor architectures.[8] A second compiler, gccgo, is a GCC frontend.[9][10]
- +Ken Thompson states that, initially, Go was purely an experimental project. Referring to himself along with the other original authors of Go, he states:[11]
@@ -1324,7 +1324,7 @@Namespaces
Variants