fix nonportable regular expression control character ranges
This commit is contained in:
parent
6ff8962a4e
commit
19c402f943
11
NEWS
11
NEWS
|
@ -28,4 +28,13 @@ opening fence.
|
|||
|
||||
*** Link reference definitions
|
||||
|
||||
Link destinations can be enclosed in an opening < and > characters.
|
||||
Link destinations can be enclosed in an opening < and >
|
||||
|
||||
** Bug fixes
|
||||
|
||||
*** Fix nonportable range expression for control characters
|
||||
|
||||
glibc 2.28 made some changes to the collation of Unicode characters
|
||||
which affect regular expression ranges. This caused the regular
|
||||
expression range for control characters to match charaacters it
|
||||
shouldn't.
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#:use-module (commonmark entities)
|
||||
#:export (ascii-punctuation-characters
|
||||
escaped-characters
|
||||
control-characters
|
||||
regular-characters
|
||||
in-parens-no-space
|
||||
link-destination
|
||||
|
@ -34,7 +35,9 @@
|
|||
;; to match ']'
|
||||
(define ascii-punctuation-characters "]!\"#$%&'()*+,-./:;<=>?@[\\^_`{|}~")
|
||||
(define escaped-characters (string-append "\\\\[" ascii-punctuation-characters "]"))
|
||||
(define regular-characters "[^\x01-\x19 ()\\\\]")
|
||||
;; can't use range as it is not portable
|
||||
(define control-characters "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19")
|
||||
(define regular-characters (string-append "[^" control-characters " ()\\\\]"))
|
||||
(define in-parens-no-space (string-append "\\((" regular-characters "|" escaped-characters "|\\\\)*\\)"))
|
||||
(define link-destination (string-append "((" regular-characters "+|"
|
||||
escaped-characters "|"
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
(define re-link-destination (make-regexp link-destination))
|
||||
(define re-link-title (make-regexp link-title))
|
||||
(define re-link-label (make-regexp link-label))
|
||||
(define re-autolink (make-regexp "^<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^ \t\n<>\x01-\x19]*)>"))
|
||||
(define re-autolink (make-regexp (string-append "^<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^ \t\n<>"
|
||||
control-characters "]*)>")))
|
||||
(define re-email-autolink (make-regexp
|
||||
(string-append "^<([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@"
|
||||
"[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?"
|
||||
|
|
Loading…
Reference in New Issue