clerk
clerk copied to clipboard
Rendering numbers and strings
Two minor issues.
- floating point number with fractional part = 0 is rendered as an integer
- strings are double quoted (ok) but in tables are not
[1.0 2.0 3.0 4.5 5.0]
;; [1 2 3 4.5 5]
;; should be [1.0 2.0 3.0 4.5 5.0]
(map str [1.0 2.0 3.0 4.5 5.0])
;; ("1.0" "2.0" "3.0" "4.5" "5.0")
(clerk/table
[[[1.0 2.0 3.0 4.5 5.0]]
[(map str [1.0 2.0 3.0 4.5 5.0])]])
;; [1 2 3 4.5 5]
;; (1.0 2.0 3.0 4.5 5.0) ;; should be ("1.0" "2.0" "3.0" "4.5" "5.0")
Thanks for the report. The number is probably due to javascript representation of numbers and something we'll look into fixing.
That strings aren't quoted in tables is intentional as it's how spreadsheet software will display strings. You can change it by removing the viewer from !viewers:
https://github.com/nextjournal/clerk/blob/8a44eba2a2fd99e6e9350cfafddf6bdea1c07bd3/src/nextjournal/clerk/viewer.cljc#L243
Ok, thanks.