Handle quoted commodities in ledger-split-commodity-string

This commit is contained in:
Craig Earls 2013-03-26 13:55:31 -04:00
parent f1882d0a56
commit c8c94e9602

View file

@ -41,7 +41,18 @@ Returns a list with (value commodity)."
(with-temp-buffer (with-temp-buffer
(insert str) (insert str)
(goto-char (point-min)) (goto-char (point-min))
(cond ((re-search-forward number-regex nil t) (cond
((re-search-forward "\"\\(.*\\)\"" nil t)
(let ((com (delete-and-extract-region
(match-beginning 1)
(match-end 1))))
(if (re-search-forward number-regex nil t)
(list
(string-to-number
(ledger-commodity-string-number-decimalize
(delete-and-extract-region (match-beginning 0) (match-end 0)) :from-user))
com))))
((re-search-forward number-regex nil t)
;; found a number in the current locale, return it in ;; found a number in the current locale, return it in
;; the car. Anything left over is annotation, ;; the car. Anything left over is annotation,
;; the first thing should be the commodity, separated ;; the first thing should be the commodity, separated