[whatwg] Simple numbers

Andrew Fedoniouk news at terrainformatica.com
Thu Jun 8 10:35:56 PDT 2006



----- Original Message ----- 
From: "Mihai Sucan" <mihai.sucan at gmail.com>
Subject: Re: [whatwg] Simple numbers


| Le Tue, 06 Jun 2006 17:22:11 +0300, Michel Fortin
| <michel.fortin at michelf.com> a écrit:
|
| > Maybe a number element would be valuable, both inside and outside
| > formulas, to provide format-neutral machine-readable numeric values:
| >
| >      <n value="123456789.12">123 456 789,12</n>
| >
| > But it surly seems a little overkill to write each numeric value twice.
| > Duplicating values seems prone to errors. So maybe a number with a
| > decimal separator attribute would be a better approach:
| >
| >      <n dec=",">123 456 789,12</n>
| >
| > Beside that, it could provide data on other kinds of numbers too:
| >
| >      <n base="16">329F 2CA0</n>
|
| Hello!
|
| I'd look for a solution via CSS. It is not possible today, but I'd say
| this would be a welcome addition.
|
| I like the idea Michel came up with. However, with a few changes. Yes, the
| value attribute would be overkill.
|
| Similar to the way you can define quotes in CSS, I'd wish we could be able
| to define number format.
|
| <n base="16">329F 2CA0</n>
| <n base="10" dec=".">12672611872.7889</n>
|
| and from CSS:
|
| number-format: base group-char decimal-char;
|
| number-format: 32 " " ".";
| number-format: 2 none ",";
|
| So, from HTML you define the format in which you provide the number. Then
| from CSS you can change the base used for displaying, the chars to be used
| for grouping digits and for separating the decimals.
|
| Both attributes are optional. The dec attribute defines the char used for
| separating the decimals (making it easier for the UA to convert the number
| to the new number-format set by CSS).
|
| This way we provide a fall back mecanism for browsers with no support for
| <nr> and the CSS property. CSS 3 Math module would be appropriate for
| adding such a property.
|
| Also, this discussion would probably better fit into www-style mailing
| list. Or ... maybe someone is interested in having this added to HTML 5.
|

There are also other cases when we need special formatting...
Thus I think it is better to have something more generic in CSS:

text-format: number | currency | date | path-ellipsis | ellipsis

This will allow to render content in current format supported by 
platform/locale.

Andrew Fedoniouk.
http://terrainformatica.com











More information about the whatwg mailing list