I don’t know how much use this will be to anyone (even me after a one time need for it), but for posterity: a System Service1 that takes a templated block and builds a sequential list from it. It allows you to set start and end count and include modified (+/-) integers in the template.
A template line can be any amount of text that you want to repeat with sequential numbering. The start and end numbers are defined with ##x,y##
and any modified versions of the current number to be inserted are specified with ##+/-x##
or ##0##
to include the current counter. For example, running the Service on this line:
<li class="item-##0,5##">This is item ##+1##</li>
Results in:
<li class="item-0">This is item 1</li>
<li class="item-1">This is item 2</li>
<li class="item-2">This is item 3</li>
<li class="item-3">This is item 4</li>
<li class="item-4">This is item 5</li>
<li class="item-5">This is item 6</li>
You can only include one start/end template in a block (any after the first are ignored), but you can include as many modified counters as you want:
<li class="item-##0,3##">This is item ##+1## which is after ##0## and before ##+2##</li>
becomes:
<li class="item-0">This is item 1 which is after 0 and before 2</li>
<li class="item-1">This is item 2 which is after 1 and before 3</li>
<li class="item-2">This is item 3 which is after 2 and before 4</li>
<li class="item-3">This is item 4 which is after 3 and before 5</li>
Like I said, limited utility, but if it would be handy for you then download below. Installation instructions are available in the how-to section. Source code available as a gist.
Increment Templated Service v3.0.2
Download Increment Templated Service v3.0.2
Repeats a selected block of text a specified number of times, replacing placeholders with the count of the current item with variable start and end numbers.
Published 07/01/12.
Updated 02/06/23. Changelog
-
Easily ported to a TextMate command, or Sublime Text 2 with a little Ruby->Python work. ↩