Parse TOML-compatible integers AND floats

master
Kaushal Modi 8 years ago
parent c2992639df
commit a186c3ef81
  1. 8
      ox-hugo.el

@ -1511,8 +1511,12 @@ string with just alphanumeric characters."
(string= "false" val)
;; or if it is a date (date, publishDate, expiryDate, lastmod)
(string-match-p org-hugo--date-time-regexp val)
;; or if it is any number
(string-match-p "\\`[[:digit:]]+\\'" val))
;; or if it is any number (integer or float)
;; https://github.com/toml-lang/toml#integer
;; Integer examples: 7, +7, -7, 7_000
;; https://github.com/toml-lang/toml#float
;; Float examples: 7.8, +7.8, -7.8, 7e-8, -7E+8
(string-match-p "\\`[+-]?[[:digit:]_]+\\(\\(\\.\\|[eE][+-]?\\)[[:digit:]]+\\)*\\'" val))
val)
((and prefer-no-quotes
(string-match-p "\\`[a-zA-Z0-9]+\\'" val))

Loading…
Cancel
Save