currency-brainstorming

(Difference between revisions)

Jump to: navigation, search
(Guillaume Lebleu)
m (Guillaume Lebleu)
Line 249: Line 249:
<pre>
<pre>
-
<span class="currencyamount">100<span class="currency"><abbr class="iso4217" title="Euro">EUR</abbr></span></span>
+
<span class="currencyamount"><span class="currency"><abbr class="iso4217" title="Euro">EUR</abbr></span>100</span>
</pre>
</pre>
Rendered view:
Rendered view:
-
<span class="currencyamount">100<span class="currency"><abbr class="iso4217" title="Euro">EUR</abbr></span></span>
+
<span class="currencyamount"><span class="currency"><abbr class="iso4217" title="Euro">EUR</abbr></span>100</span>
Using another currency representation:
Using another currency representation:
<pre>
<pre>
-
<span class="currencyamount">100<span class="currency"><abbr title="Canadian dollar">CDN</abbr></span></span>
+
<span class="currencyamount"><span class="currency"><abbr class="currencysymbol" title="Canadian dollar">CDN</abbr></span>100</span>
</pre>
</pre>
Rendered view:
Rendered view:
-
<span class="currencyamount">100<span class="currency"><abbr title="Canadian dollar">CDN</abbr></span></span>
+
<span class="currencyamount"><span class="currency"><abbr class="currencysymbol" title="Canadian dollar">CDN</abbr></span>100</span>
 +
 
 +
iso4217 IS A currencysymbol
In a table:
In a table:
<pre>
<pre>
-
<table><tr><th class="currencyamount">Price (<span class="currency"><abbr title="Canadian dollar">CDN</abbr></span>)</th></tr><tr><td>100</td></tr></table>
+
<table>
 +
  <tr>
 +
      <th class="currencyamount">Price (<span class="currency"><abbr title="Canadian dollar">CDN</abbr></span>)</th>
 +
  </tr>
 +
  <tr>
 +
      <td>100</td>
 +
  </tr>
 +
</table>
</pre>
</pre>

Revision as of 17:16, 23 September 2006

Contents

Brainstorming

Brainstorming for the proposed currency microformat.


Ben Buchanan

Verbose but extensible and explicitly defines all values (without breaking DRY):

<div class="currency">
  <p class="figure">
     <span class="code">code</span>
     <span class="sign">symbol</span>
     <span class="amount">12345</span>
  </p>
</div>

"figure" is there to both explicitly associate the code, sign and amount but also allow the potential for more than one currency figure to be placed within the container. It does anticipate further development though and is the most easily dropped item at the early stage.

Without figure:

<div class="currency">
     <span class="code">code</span>
     <span class="sign">symbol</span>
     <span class="amount">12345</span>
</div>

Super shortened, relying on the parser to identify everything via implied order/structure:

<div class="currency">ABC12345$</div>

Although the simplest solution, it has a notable vulnerability: some currencies have/had three-letter abbreviations for their currency sign, instead of a symbol. This would make it very difficult for a parser to accurately identify such a currency.

In addition, it should be noted that the order alone cannot be used to identify which parts are code, sign and amount; since many currencies are denoted with the sign after the number.

Super shortened, but specifying a currency code as a class:

<div class="currency ABC">12345$</div>

It defines...

  1. we're talking about money - ISO standard implied,
  2. we're talking about the USD variety,
  3. we're talking fifty units of that money,
  4. a parser could work out the numbers and the symbol.

The biggest limitation I can see for that shorthand is that the currency code is not displayed visibly to human readers. The currency code is useful information to viewers and ideally should be displayed.

Shortened (including dropping 'figure', but explicitly defining and displaying the currency code. This would allow a parser to treat any remaining numbers as the amount; and any remaining a-z or symbol as the sign:

<div class="currency">
  <span class="code">ABC</span>12345$</p>
</div>

Charles Iliya Krempeaux

Maybe something like...

Pay me <abbr class="currency" title="CAD">$</abbr>5.00 now!

Although something like the the following might be better...

Pay me <span class="money"><abbr class="currency" title="CAD">$</abbr>5.00</span> now!

But it might be more semantic salt than is considered necessary. Just having the abbr with the class-currency near a number might be good enough. But that's open for discussion though.

Ben Ward

Could pure HTML be sufficient?

<html lang="en-gb">
<p>My new T-Shirts cost £30, but it cost my friend in Canada <span lang="en-ca">$34</span></p> 
</html>

Arve Bersvendsen

<p lang="nb">Den kanadiske prisen på t-skjorten var <span class="currency CAD">34 $</span>.</p>

Mike Stickel

<span class="money"><abbr class="currency" title="CAD eng">$</abbr><span class="amount">5.00</span></span>

In this format the wrapping would be "money" or something similar followed by either the actual "amount" or the "currency", depending on what rules your country/language follows in regards to the order. Since there can be a difference between different languages within countries I thought it might be a good idea to include that in the "currency" definition of the formating, eg., "CAD eng" or "CAD fr". It could also give sites that list multiple languages a way to differentiate when they show multiple prices.

Ciaran McNulty

The only microformat that I've noticed currency units in is hListing, and that deliberately shies away from parsing the actual values because it's too free-form in most existing Listing formats.

My own preference would be for something like:

<p class="money">This item costs
  <span class="currency">GBP</span>
  <span class="amount">10.00</span>
</p>

Which with similar parsing rules to existing formats would also allow things like:

<p class="money">
  It'll cost you
  <abbr class="currency" title="50.00">fifty</abbr>
  <abbr class="amount" title="GBP">quid</abbr>
  , mate!
</p>

Or, a more complex example with multiple languages:

<p lang="en">Price:
<span class="money">
  <abbr class="currency" title="GBP">£</abbr>  
  <span class="amount">1,250.00</span> 
</span> 
<span lang="fr" class="money">
  (Prix:
  <span class="amount">1600,00</span>
  <abbr class="currency" title="EUR">€</abbr>
  )
</span>
</p>

Andy Mabbett

Straw man proposal

(this reflects Ciaran McNulty's proposals, above)

In order to use currency as a sub-class, the parent should be named 'money'

All classes may occur only once, apart from symbol (to allow for "£14 6s 2d") and unit (to allow for "five pounds 23 pence").

Examples

Thus:

	<span class="money">A widget costs 
		<abbr class="currency symbol" title="USD">$</abbr>
		<span class="amount">12.57</span>
	</span>
	<tr>
		<th>Spaghetti-knitter</th>
		<td class="money">
			<abbr class="currency" title="USD">
				<span class="amount">42.67</span>
			</abbr>
		</td>
	</tr>
	<span class="money">
	Can you spare
		<abbr class="amount" title="10">ten</abbr>
		<abbr class="currency" title="USD">
			<span class="unit">dollars</span>
		</abbr>?
	</span>
	<span class="money">
		It was worth 
		<abbr class="amount" title="0.5">50</abbr> 
		<abbr class="currency" title="GBP">
			<span class="unit">pence</span>.
		</abbr>
	</span>

(note, in the above, that "unit" does not relate directly to the amount in the amount's title abttibute - it's 0.5 pounds, not 0.5 pence.)

	<span class="money">In 
		<span class="year">1857</span>
		 a Dickens novel cost
		<abbr class="amount" title="0.05">1</abbr>
		<abbr class="currency" title="GBP">
			<abbr class="symbol unit" title="shilling">/</abbr>
		</abbr>
	</span>

(The above might be rendered as "... 1/ (worth £4.50 in modern terms" (or whatever the value would be).)

<span class="money">
	<abbr class="amount" title="14.32">
		<abbr class="currency" title="GBP">
			<abbr class="symbol" title="pound">£</abbr>14 
		</abbr>
			6<abbr class="unit" title="shilling">s</abbr> 
			4<abbr class="unit" title="old-penny">d</abbr>
	</abbr>
</span>
	<span class="money">
		<abbr class="equivalence" title="EUR">
			<abbr class="currency" title="FFR">10</abbr>
		</abbr>
	</span>

The following, simplified for clarity, from [1]:

    On
    <span class="currency">
	<abbr class=date" title="1922-08-01>August 1</abbr>, 
	the US Dollar still stood at 
	<span class="value">643</span> 
	<abbr class="type="GDM">Marks</abbr>
    </span>
    to the Dollar. But on 
    <span class="currency">
	<abbr class=date" title="1922-09-05>September 5</abbr> 
	the dollar had already risen to 
	<span class="value">1,440</span> 
	<abbr class="type="GDM">Marks</abbr></span>
    </span>

Is there anything sensible which can't be done with the above?

Assumptions
Issues
	<tr>
		<th>Spaghetti-knitter</th>
		<td class="money USD amount">42.67</span></td>
	</tr>


Guillaume Lebleu

In-line:

Using a standard currency code:

<span class="currencyamount"><span class="currency"><abbr class="iso4217" title="Euro">EUR</abbr></span>100</span>

Rendered view:

EUR100

Using another currency representation:

<span class="currencyamount"><span class="currency"><abbr class="currencysymbol" title="Canadian dollar">CDN</abbr></span>100</span>

Rendered view:

CDN100

iso4217 IS A currencysymbol

In a table:

<table>
   <tr>
      <th class="currencyamount">Price (<span class="currency"><abbr title="Canadian dollar">CDN</abbr></span>)</th>  
   </tr>
   <tr>
      <td>100</td>
   </tr>
</table>

Rendered view:

Price (CDN)
100

References

currency-brainstorming was last modified: Wednesday, December 31st, 1969

Views