0

Say I have this:

...
    <li class='tab'><a href="#tabs2-7">7</a></li>
    <li class="tab"><a href="#tab2-8">8</a></li>
...

...and I'd like to use Sparkup in my editor to add another say 6 tabs...so I run the sparkup command:

li.tab > a[href=#tab2-$]{$}*6

but it comes out all wrong,

    <li class="tab"><a href="#tab2-8">8</a></li>
    <li class="tab">
       <a href="#tab2-1">1</a>
       <a href="#tab2-2">2</a>
       <a href="#tab2-3">3</a>
       ...
    </li>

My first thought was that my syntax should have been:

(li.tab > a[href=#tab2-$]{$})*6

But that did pretty much the same thing...except this time it didn't insert the second number:

    <li class="tab"><a href="#tab2-8">8</a></li>
    <li class="tab">
       <a href="#tab2-1">$</a>
       <a href="#tab2-2">$</a>
       <a href="#tab2-3">$</a>
       ...
    </li>

Now the range problem (starting at 9 instead of 1) is just a minor annoyance, but what if I want it to repeat the li as well as the a tag?

And yes, before you go off about it, I am indeed aware that I could create all of this stuff just using a simple for loop; but that wasn't part of the question now was it?

leeand00
  • 25,510
  • 39
  • 140
  • 297

1 Answers1

1

You are almost there:

li.tab*6 > a[href=#tab2-$]{$}

You want to create 6 <li> so that's where you should put your multiplier.

No need to be defensive.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • Sorry man, not everybody thinks it's a useful tool (but I do!) – leeand00 Apr 23 '12 at 22:59
  • I love Sparkup too, saves me so much time when doing damn newsletters. Anyway, my answer was a bit too fast: I didn't fully understand what you wanted to do with the multiplier and `$`. Here, using your first snippet doesn't change the content of `a`: it stays as a `$` and is not incremented. That's weird. – romainl Apr 24 '12 at 05:52
  • I just noticed that your editor was Scribes, not Vim. It probably makes a slight difference, here. – romainl Apr 24 '12 at 05:58
  • Well it all works off of the bash shell program anyway...I have that installed. (Unless it's integrated into Scribes which I I'm not real sure about...) I use vim too...I just didn't install the plugin to try it out as I'm still looking at another way of configuring it. With Scribes I just wanted to try something new and see what it was like. – leeand00 Apr 24 '12 at 17:30