summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-12-06 17:28:04 +0700
committerShulhan <ms@kilabit.info>2021-12-06 17:28:04 +0700
commitd0ebdcaeaa5c52b7ff8513d1a324607e104ead3c (patch)
treeeedfa8deee5f33218569fddc913924652dbdb09e
parent674f4d404ec30d363433b72b1c6fd5ffe8a4d1b6 (diff)
downloadasciidoctor-go-d0ebdcaeaa5c52b7ff8513d1a324607e104ead3c.tar.xz
all: allow colon ':' and period '.' on the ID
According to XML spec [1], the colon is allowed as the first and the next character. While period is only allowed on the next characters. [1] https://www.w3.org/TR/REC-xml/#NT-Name
-rw-r--r--parser.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/parser.go b/parser.go
index fdc6daa..8b0b8d5 100644
--- a/parser.go
+++ b/parser.go
@@ -497,13 +497,13 @@ func isTitle(line []byte) bool {
func isValidID(id []byte) bool {
for x, r := range string(id) {
if x == 0 {
- if !(r == '-' || r == '_' || unicode.IsLetter(r)) {
+ if !(r == ':' || r == '-' || r == '_' || unicode.IsLetter(r)) {
return false
}
continue
}
- if r == '-' || r == '_' || unicode.IsLetter(r) ||
- unicode.IsDigit(r) {
+ if r == ':' || r == '-' || r == '_' || r == '.' ||
+ unicode.IsLetter(r) || unicode.IsDigit(r) {
continue
}
return false