gtg922r / obsidian-numerals

An obsidian plugin which turns a math code block into a full featured calculator
Other
389 stars 7 forks source link

Formatting error with IT style (100.000,1) #40

Closed kobayashison closed 1 year ago

kobayashison commented 1 year ago

I set IT style formatting (100.000,1), but if I use the comma as decimal separator, it get considered as a thousand devider, but the result will use the comma as decimal separator (note that the result is in km²):

area_pannello = 1,735 m * 1,120 m → 1,943 km^2

If I use the point as decimal separator, it consider it right, but in the result will use the comma as separator:

area_pannello = 1.735 m * 1.120 m →1,943 m^2
kobayashison commented 1 year ago

Probably this example can explain better:

area_pannello = 1,735 m * 1,120 m       → 1,943 km^2
area_pannello = 1735 m * 1120 m         → 1,943 km^2
area_pannello = 1.735 m * 1.120 m       → 1,943 m^2
area_pannello = 1,735 m * 1,120 m in m^2    → 1 943 200 m^2
gtg922r commented 1 year ago

Unfortunately the formatting style only applies to the rendered output, NOT the input. Input text must use comma for thousands separator (or no separator) and period for decimal separator. I fully recognize this is sub-optimal and confusing for users. See #53 for feature request to support this. Given the effort involved, it will need to happen after I add metadata support, summing, and some of the other frequently requested features.

The math library that Numerals uses doesn't support either thousands separators or decimal separators other than period. I do some pre- and post- processing to add this capability, however its difficult to support different separators in the input based on user settings

I'm going to close this as a duplicate of #53

kobayashison commented 1 year ago

Thanks. Yes, it's so confusing that I think would be just better to hide the code about the style formatting till when input formatting will be added.