From a186c3ef81f3db46ff36555d3275e4e09e32c2dd Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Sun, 12 Nov 2017 01:53:48 -0500 Subject: [PATCH] Parse TOML-compatible integers AND floats --- ox-hugo.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ox-hugo.el b/ox-hugo.el index b296cb5..becf93e 100644 --- a/ox-hugo.el +++ b/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))