Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[textile] Is it possible to set the class of the first LI via textile?
Hi TXPers,
I’m familiar with the following textile:
*(myList) hello
*(classFor2ndLi) world
Producing this:
<ul class="myList">
<li>hello</>
<li class="classFor2ndLi">world</>
</ul>
But I don’t seem to be able to find a way to add a class for the first li
in a list.
I’ve seen mention of putting a class in front like this (listClass)*(LiClass) hello
but it does not seem to work, at least with the Textile built into TXP 4.4.1.
Does anyone know if there is a way to add a class to the first li
in a list via Textile?
Thanks in advance for any comments, cheers, -Alan
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
#2 2012-01-29 18:01:35
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: [textile] Is it possible to set the class of the first LI via textile?
alanfluff wrote:
I’ve seen mention of putting a class in front like this
(listClass)*(LiClass) hello
but it does not seem to work, at least with the Textile built into TXP 4.4.1.
Tested that for you with Textile 2.3: No joy :p
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
I needed something similar recently and resorted to this to get a unique style in the first list item:
*(something) %(something_else)First%
* Second
Last edited by joebaich (2012-01-29 19:17:33)
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
It’s possible in latest versions of Textile (since 2.2):
#(class#id).
#(first) Item 1
#(second) Item 2
#(third) Item 3
Check it here: textile.sitemonks.com/?eg=RefGuide
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
Yes. New syntax introduced in Textile 2.2 allows the first item to just specify the container if you add a dot:
*(myList).
*(first-item) hello
*(classFor2ndLi) world
Produces this:
<ul class="myList">
<li class="first-item">hello</li>
<li class="classFor2ndLi">world</li>
</ul>
EDIT: too slow for maniqui ninja-fingers :-)
Last edited by Bloke (2012-01-29 21:02:06)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
Missed that until now, thanks Maniqui and Bloke. Live and learn.
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
Wow!
Thanks you all for the comments, I’ve certainly learnt something and I’m just glad I asked.
Just tested it — totally brilliant! And glad to have found this extra Textile resource too, in all my Googling I’ve not found http://textile.sitemonks.com/ before. Bookmarked!
Cheers one and all! -Alan
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
PS: and if you don’t need a class or ID for the UL
(only want them from the LI
s) then as per the 2.2 spec this works AOK:
*.
*(item1) hello
*(item2) world
Excellent :)
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
Glad it’s useful. As a further clarification, this syntax applies to all lists in Textile: bulleted (*), numbered (#) and definition (;), though with the latter you can go a bit further because of the dt/dd:
; War
:(one) Defcon 1
:(two) Defcon 2
Renders:
<dl>
<dt>War</dt>
<dd class="one">Defcon 1</dd>
<dd class="two">Defcon 2</dd>
</dl>
This one:
;.
:(one) Termless
:(two) Definitions
;;(subset) But termed and classed
::(subdef) Sub-definitions
Renders:
<dl>
<dd class="one">Termless</dd>
<dd class="two">Definitions
<dl class="subset">
<dt>But termed and classed</dt>
<dd class="subdef">Sub-definitions</dd>
</dl>
</dd>
</dl>
While:
;(list).
;(term) My definition
:(one) of a boombastic jazz style
:(two) is here
Renders:
<dl class="list">
<dt class="term">My definition</dt>
<dd class="one">of a boombastic jazz style</dd>
<dd class="two">is here</dd>
</dl>
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
Thanks for the further explanation Stef, brilliant.
Do you happen to know if there is a definitive place on the web where Textile lives, in the same way as there is this for Markdown?
I’m guessing the answer is no (sad) but I thought I’d ask just in case I was missing something.
Cheers, -Alan
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
alanfluff wrote:
a definitive place on the web where Textile lives
Not yet. It’s been discussed and I guess it just comes down to finding someone with a bit of time to register a suitable domain, set up a (Txp) site to showcase and test the markup (like the sitemonks site does today) and make sure the site has some way to launch or host the various ports of Textile in various other programming languages.
This is one of those things that’s not rocket science, just time science :-) Maybe someone’ll offer to do it one day.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: [textile] Is it possible to set the class of the first LI via textile?
I’d be interested in helping but I know I couldn’t do it now.
If you happen to bump into this thread again before I reply again feel free to kick me in the-thread to see if my circumstances have changed and I’m able to help.
Cheers, -Alan
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline