Permalink
Browse files

Merge pull request #22 from rmzelle/ordinals

Specification text for new ordinal suffix logic
  • Loading branch information...
2 parents 305b726 + d0b4e50 commit ceda3f1534270b2c2daec1d6f25aa3ef186c0269 @rmzelle rmzelle committed Jul 31, 2012
Showing with 46 additions and 16 deletions.
  1. +46 −16 specification.txt
View
@@ -579,14 +579,51 @@ Fallback`_), there is fallback to other forms: "verb-short" first falls back to
back to "long". If no locale or form fallback is available, the term is rendered
as a empty string.
-`Gender-specific ordinals`_ are activated through the ``gender`` and
-``gender-form`` attributes on ``cs:term``, which are described below.
+The ``match``, ``gender``, and ``gender-form`` attributes can be used on
+``cs:term`` for the formatting of number variables rendered as ordinals (e.g.
+"first", "2nd"). See `Ordinal Suffixes`_ and `Gender-specific Ordinals`_ below.
Term content should not contain markup such as LaTeX or HTML. `Superscripted
Unicode characters`__ can be used for superscripting.
__ http://unicode.org/reports/tr30/datafiles/SuperscriptFolding.txt
+Ordinal Suffixes
+^^^^^^^^^^^^^^^^
+
+Number variables can be rendered with ``cs:number`` in the "ordinal" form, e.g.
+"2nd" (see `Number`_). The ordinal suffixes ("nd" for "2nd") are defined with
+terms.
+
+The "ordinal" term defines the default ordinal suffix. This default suffix may
+be overridden for certain numbers with the following terms:
+
+- "ordinal-00" through "ordinal-09" - by default, a term in this group is used
+ when the last digit in the term name matches the last digit of the rendered
+ number. E.g. "ordinal-00" would match the numbers "0", "10", "20", etc. By
+ setting the optional ``match`` attribute to "2-digits" ("1-digit" is the
+ default), matches are limited to numbers where the two last digits agree ("0",
+ "100", "200", etc.). When ``match`` is set to "whole-number", there is only a
+ match if the number is the same as that of the term.
+
+- "ordinal-10" through "ordinal-99" - by default, a term in this group is used
+ when the last two digits in the term name match the last two digits of the
+ rendered number. When the optional ``match`` attribute is set to
+ "whole-number", there is only a match if the number is the same as that of the
+ term.
+
+When a number has matching terms from both groups (e.g. "13" can match
+"ordinal-03" and "ordinal-13"), the term from the "ordinal-10" through
+"ordinal-99" group is used.
+
+Ordinal terms work differently in CSL 1.0.1 than they did in CSL 1.0. When
+neither the style or locale file define the "ordinal" term, but do define the
+terms "ordinal-01" through "ordinal-04", the original CSL 1.0 scheme is used:
+"ordinal-01" is used for numbers ending on a 1 (except those ending on 11),
+"ordinal-02" for those ending on a 2 (except those ending on 12), "ordinal-03"
+for those ending on a 3 (except those ending on 13) and "ordinal-04" for all
+other numbers.
+
Gender-specific Ordinals
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -620,11 +657,9 @@ and "3e janvier" ("January 3rd"):
</term>
<term name="edition" form="short">éd.</term>
<term name="month-01" gender="masculine">janvier</term>
- <term name="ordinal-01" gender-form="feminine">re</term>
- <term name="ordinal-01" gender-form="masculine">er</term>
- <term name="ordinal-02">e</term>
- <term name="ordinal-03">e</term>
- <term name="ordinal-04">e</term>
+ <term name="ordinal">e</term>
+ <term name="ordinal-01" gender-form="feminine" match="whole-number">re</term>
+ <term name="ordinal-01" gender-form="masculine" match="whole-number">er</term>
</terms>
</locale>
@@ -896,11 +931,8 @@ Extracted numbers can be formatted via the optional ``form`` attribute, with
values:
- "numeric" - (default), e.g. "1", "2", "3"
-- "ordinal" - e.g. "1st", "2nd", "3rd". Ordinal suffixes are defined with the
- `terms`_ "ordinal-01" to "ordinal-04". "ordinal-01" is used for numbers
- ending on a 1 (except those ending on 11), "ordinal-02" for those ending on a
- 2 (except those ending on 12), "ordinal-03" for those ending on a 3 (except
- those ending on 13) and "ordinal-04" for all other numbers.
+- "ordinal" - e.g. "1st", "2nd", "3rd". Ordinal suffixes are defined with
+ terms (see `Ordinal Suffixes`_).
- "long-ordinal" - e.g. "first", "second", "third". Long ordinals are defined
with the `terms`_ "long-ordinal-01" to "long-ordinal-10", which are used for
the numbers 1 through 10. For other numbers "long-ordinal" falls back to
@@ -2711,10 +2743,8 @@ Months
Ordinals
~~~~~~~~
-- ordinal-01
-- ordinal-02
-- ordinal-03
-- ordinal-04
+- ordinal
+- ordinal-00 through ordinal-99
- long-ordinal-01
- long-ordinal-02
- long-ordinal-03

0 comments on commit ceda3f1

Please sign in to comment.