-
Notifications
You must be signed in to change notification settings - Fork 23
Fallbacks when referring to a list item in a list with non–Latin counters
Assume we have some HTML code as follows. (I'm using english text, rather than Georgian, just to make the example easier to follow for those who don't speak Georgian.)
<ol>
<li>one</li>
<li>two</li>
<li>three</li>
</ol>
<p>Check out item ბ.</p>
and assume that we styled the list to use georgian counters.
li { list-style-type: georgian; }
The page would look like this when displayed:
ა. one
ბ. two
გ. three
Check out item ბ.
Now suppose you load the page without CSS. It would look like this.
- one
- two
- three
Check out item ბ.
It would be better if the paragraph below the text also defaulted to the same counter style as the list.
One way to do this (there's probably a better way) might be to add the following CSS to the style sheet.
body { counter-reset: listref; }
.cref::before {
content: counter(listref, georgian)
}
Then write the paragraph text as
<p>Check out item <span class="cref" style="counter-reset:listref 2;"></span>.</p>
In the absence of CSS, you would then see
- one
- two
- three
Check out item 2.
I'm not sure, however, how to handle the following:
- nested counters, like "Check out item ბ.ა.გ.", ie. item 2.1.3.
- you'd have to calculate the number in decimal when using non-decimal counting systems
- you'd have to rejig the reference if an item was added to the earlier part of the list
I'm inclined to think that it would be best to put an id on the li
element, and refer to it using some markup such as
Check out item <liref ref="theIDonTheLIelement">.
where the liref element works out the counter-style in use in the list and replaces itself with the appropriate counter, and automatically detects if CSS is not available and computes the appropriate decimal value instead.