Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
ideas:content-formatting [2008/01/14 10:46] – rearrange rationale fantasaiideas:content-formatting [2008/01/14 14:14] – Added text about parsing (unfinished) itpastorn
Line 18: Line 18:
  
 Use XSLT's format-number syntax as a starting ground Use XSLT's format-number syntax as a starting ground
 +
  
 ==== Rationale ==== ==== Rationale ====
  
-   * i18n +   * i18n - numbers are displayed in many different ways across the world 
-   * Enhanced usability, without sacrificing accessibility or scriptability +   * Enhanced usability, without sacrificing accessibility or scriptability. Grouping numbers in thousands or in pairs will make the easier to read for most users. We do want to suppress line breaks, though. 
-   * Enhanced accessibility, without sacrificing usability or scriptability+   * Enhanced accessibility, without sacrificing usability or scriptability. When numbers are grouped it will be very hard to make some heuristics for screen readers to separate instances where it is useful to insert words like "million" and "thousand" and when such words would actually be a nuisance. 
  
 This is a question about visual presentation. As such it should be handled with CSS. This is a question about visual presentation. As such it should be handled with CSS.
 No other technology can be made media-specific. No other technology can be made media-specific.
 +
 +The ability to format numbers without changing their actual value is a common practice in spreadsheet software, and should be just as easy on the web.
  
 === Example HTML === === Example HTML ===
Line 44: Line 47:
 "nine hundred and eighty seven million six hundred and fifty four thousand three hundred and twenty "nine hundred and eighty seven million six hundred and fifty four thousand three hundred and twenty
 one **comma** zero zero Swedish crowns" one **comma** zero zero Swedish crowns"
 +
 +  <span class="creditcard">1234567890123456</span>
 +
 +Should be displayed as ''1234 5678 9012 3456'' and spoken as ''12 34 56 78 90 12 34 56''
 +
  
 ==== New CSS rules ==== ==== New CSS rules ====
  
-**@decimal-format** that draws its ideas from xsl:decimal-format+=== @decimal-format === 
 + 
 +This rule draws its ideas from xsl:decimal-format
 + 
 +It is used to specify the same things as its XSL counterpart, e.g. grouping and decimal separators. 
 + 
 +=== number-format ===
  
-**number-format**   that draws its ideas from xsl:number-format+This rule draws its ideas from xsl:number-format. It shall be used to format actual output.
  
 +It consists of two parts for its value. A string that is identical to the second argument in XSL number format, and an
 +optional reference to a decimal format, specified with an "at-rule" (see above).
  
 ==== Example CSS ==== ==== Example CSS ====
Line 63: Line 79:
     grouping-separator: " ";     grouping-separator: " ";
     decimal-separator : ","     decimal-separator : ","
 +  }
 +  @decimal-format creditcard {
 +    grouping-separator: " ";
   }   }
   @media all {   @media all {
Line 79: Line 98:
     td.sweprice {     td.sweprice {
         number-format: "### ##0,00", "sweprice";         number-format: "### ##0,00", "sweprice";
 +    }
 +    .creditcard {
 +        number-format: "#### ####", "creditcard";
     }     }
     td.sweprice::after {     td.sweprice::after {
Line 88: Line 110:
         Grouping both unnecessary and unwanted, words like         Grouping both unnecessary and unwanted, words like
        "billion", "million" and "thousand" should be spelled out        "billion", "million" and "thousand" should be spelled out
 +       Those words should only be spelled out by a screen reader when
 +       grouping is not specified.
     */      */ 
     td.price {     td.price {
Line 100: Line 124:
     td.sweprice::after {     td.sweprice::after {
         content: " Swedish crowns";         content: " Swedish crowns";
 +    }
 +    .creditcard {
 +        /* Speak numbers in pairs, no nead to hear the word "thousand" */
 +        number-format: "## ## ## ##", "creditcard";
     }     }
   }   }
 +
 +
 +==== Parsing ====
 +
 +When an UA sees that an element has a number format rule, it should try to convert that elements textcontent to a number.
 +
 +If such a conversion is not possible, the CSS rule should be ignored. This rules is **primarily** intended for table cells, short headings, simple inline elements such as span, some form elements and perhaps a new number element.
  
 ==== Remarks ==== ==== Remarks ====
 
ideas/content-formatting.txt · Last modified: 2014/12/09 15:48 by 127.0.0.1
Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki