Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[textile] Classes and List-Items
To be able to apply CSS-classes und ids to list-items instead of the whole list i’ve patched the Textile-Class from Version 4.0.4:
notextile..
// ——————————————————————————————-
function fList($m)
{
$text = explode(“\n”, $m0);
foreach($text as $line) {
$nextline = next($text);
if (preg_match(“/^(1+)($this->a$this->c) (.*)$/s”, $line, $m)) {
list(, $tl, $atts, $content) = $m;
$nl = ‘’;
if (preg_match(“/^(1+)($this->a$this->c) (.*)$/s”, $nextline, $nm))
$nl = $nm1;
if (!isset($lists[$tl])) {
$lists[$tl] = true;
$atts = $this->pba($atts);
$line = “\t<” . $this->lT($tl) . “l>\n\t\t<li$atts>” . $this->graf($content);
} else {
$atts = $this->pba($atts);
$line = “\t\t<li$atts>” . $this->graf($content);
}
I hope this helps anybody…
Last edited by e-sven (2007-05-10 01:29:14)
Sven
<bc />
Offline
Re: [textile] Classes and List-Items
Textiled :) :
// -------------------------------------------------------------
function fList($m)
{
$text = explode("\n", $m[0]);
foreach($text as $line) {
$nextline = next($text);
if (preg_match("/^([#*]+)($this->a$this->c) (.*)$/s", $line, $m)) {
list(, $tl, $atts, $content) = $m;
$nl = '';
if (preg_match("/^([#*]+)($this->a$this->c) (.*)$/s", $nextline, $nm))
$nl = $nm[1];
if (!isset($lists[$tl])) {
$lists[$tl] = true;
$atts = $this->pba($atts);
$line = "\t<" . $this->lT($tl) . "l>\n\t\t<li$atts>" . $this->graf($content);
} else {
$atts = $this->pba($atts);
$line = "\t\t<li$atts>" . $this->graf($content);
}
if(strlen($nl) <= strlen($tl)) $line .= "</li>";
foreach(array_reverse($lists) as $k => $v) {
if(strlen($k) > strlen($nl)) {
$line .= "\n\t</" . $this->lT($k) . "l>";
if(strlen($k) > 1)
$line .= "</li>";
unset($lists[$k]);
}
}
}
$out[] = $line;
}
return join("\n", $out);
}
// -------------------------------------------------------------
Last edited by jm (2007-05-10 05:13:54)
Offline
#3 2007-05-11 00:18:58
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [textile] Classes and List-Items
This breaks backwards compatibility, so it can’t be included in stable versions.
Last edited by zem (2007-05-11 00:19:16)
Alex
Offline
Re: [textile] Classes and List-Items
Well, I know. But there has to be a way to solve this. Perhaps something like this?
*(class#id). // apply to li
*(class#id) // apply to ul or ol
Sven
<bc />
Offline
#5 2007-05-11 02:12:38
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [textile] Classes and List-Items
This would be more consistent with the table syntax:
list(listclass#listid).
*(itemclass#itemid) foo
* bar
Alex
Offline