<dt>first item</dt>
<dd>first definition</dd>
<dt>second item</dt>
<dd>second definition</dd>
becomes
<dt>1. first item</dt>
<dd>first definition</dd>
<dt>2. second item</dt>
<dd>secind definition</dd>
and so on. What would be my best approach? Each dt has multiple
dds in the actual document.
Thanks.
Ken
--
Orange County Website Design
http://simplelives.com
How about using the CSS content property? For example:
.list {
counter-reset: my-counter;
}
.list dt:before {
content: counter(my-counter) ". ";
counter-increment: my-counter;
}
If you'd rather insert the numbers into the HTML, you would need a script
of some kind. Here's a simple one in Perl, which also replaces existing
numbering, if any:
#!perl -p
s/(<dt[^>]*>)(\d+\. )?/$1 . ++$i . ". "/ige;
Ronald
Ken
r...@tamias.net (Ronald J Kimball) wrote on 4/11/12 6:25 PM
>Yes! Thanks. For some reason, I had never before come across
>counter-increment. That will work perfectly for me.
>
>Ken
Just remember that using counter-increment assumes that the user has
a browser that supports this tag. A better solution that does not
rely on the user having a compliant browser is to have the page
generated via PHP (so you can generate the counter on the fly. All
that is needed is to replace the <dt> tags with a php function call
that increments a counter and then outputs <dt>$Counter .
Ken
rar...@banet.net (Robert A. Rosenberg) wrote on 4/11/12 8:40 PM
--
>Thanks, Robert. Sensible suggestion. As it happens, these lists
>won't be on the web and we are covered as far as browser support.
No problem. In that case, my comment is not applicable to your
situation. I tend to look for hidden assumptions in other replies (as
in this case) and point them out so the final solution is a fit.
There is nothing worse than to make the effort to implement a
solution only to find that there is a caveat on its usage that was
not mentioned. This habit, as in this case, causes me to make
comments that are unnecessary. OTOH, someone who is lurking here who
has a similar need my find my warning of use in avoiding a pitfall of
assuming that there is no hidden caveats to the counter-increment
method.
>
>Ken
>
>rar...@banet.net (Robert A. Rosenberg) wrote on 4/11/12 8:40 PM
>
>>At 20:04 -0700 on 04/11/2012, Ken Lanxner wrote about Re: sequential
>>numbering:
>>
>>>Yes! Thanks. For some reason, I had never before come across
>>>counter-increment. That will work perfectly for me.
>>>
>>>Ken
>>
>>Just remember that using counter-increment assumes that the user has a
>>browser that supports this tag. A better solution that does not rely
>>on the user having a compliant browser is to have the page generated
>>via PHP (so you can generate the counter on the fly. All that is
>>needed is to replace the <dt> tags with a php function call that
>>increments a counter and then outputs <dt>$Counter .
>
>--
>Orange County Website Design
>http://simplelives.com
>
>--
>You received this message because you are subscribed to the "BBEdit
>Talk" discussion group on Google Groups.
>To post to this group, send email to bbe...@googlegroups.com
>To unsubscribe from this group, send email to
>bbedit+un...@googlegroups.com
>For more options, visit this group at
><http://groups.google.com/group/bbedit?hl=en>
>If you have a feature request or would like to report a problem,
>please email "sup...@barebones.com" rather than posting to the
>group.
>Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
If you'd rather insert the numbers into the HTML, you would need a scriptof some kind. Here's a simple one in Perl, which also replaces existing
numbering, if any:#!perl -p
s/(<dt[^>]*>)(\d+\. )?/$1 . ++$i . ". "/ige;