On Wed, Apr 11, 2012 at 03:27:58PM -0700, Ken Lanxner wrote:
> Hi. I have a long definition list and need to number each dt so that
> 
> <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.
> 

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

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to