Index: pi1/class.tx_cssstyledcontent_pi1.php
===================================================================
--- pi1/class.tx_cssstyledcontent_pi1.php (revision 2352)
+++ pi1/class.tx_cssstyledcontent_pi1.php (working copy)
@@ -99,32 +99,96 @@
if ($hookObj = &$this->hookRequest('render_bullets')) {
return $hookObj->render_bullets($content,$conf);
} else {
-
// Get bodytext field content, returning blank if empty:
$content = trim($this->cObj->data['bodytext']);
if (!strcmp($content,'')) return '';
-
+
// Split into single lines:
$lines = t3lib_div::trimExplode(chr(10),$content);
+
+ //How many lines do we have reduced of one, because the array numbering begins with 0
+ $linecount = count($lines)-1;
+
+ //On which level was the previous entry in this List
+ $prelevel=0;
+
+
while(list($k)=each($lines)) {
- $lines[$k]='
-
'.$this->cObj->stdWrap($lines[$k],$conf['innerStdWrap.']).'';
+ //On which Level in the Bulletlist are we now
+ $level=0;
+ while ($lines[$k]{$level} == '|') {
+ $level++;
+ }
+
+ $pre = '';
+ $post = '';
+
+ if ($level > $prelevel) {
+ //The Level of the current Entry deeper than of the Entry before
+ $i = $level;
+ $pre.=chr(10);
+ while ($i > $prelevel) {
+ if ($i == $level && $k != 0) {
+ //If we are at the same level like the previous entry, there is already an opening tag (Except this is the very first entry on this bulletlist)
+ $pre.=''.chr(10);
+ } else {
+ //We have to write the - tag self
+ $pre.='
- '.chr(10).'
';
+ }
+ $i--;
+ }
+ $pre.='- ';
+
+ } elseif ($level < $prelevel) {
+ //The Level of the current Entry is on an higher Level than the previous Entry
+ $i = $level;
+ while ($i < $prelevel) {
+ $pre.='
'.chr(10).'
';
+ $i++;
+ }
+ $pre.=chr(10);
+ $pre.=' '.chr(10).'- ';
+
+ } else {
+ //Entry is on the same level as the entry before.
+ //If it is the first Entry we donīt have to close a previous Entry
+ if ($k!=0) {
+ $pre .= '
'.chr(10).'- ';
+ } else {
+ $pre .= chr(10).'
- ';
+ }
+ }
+
+ //Close all open tags on the last entry
+ if ($linecount == $k) {
+ $i = 0;
+ while ($i < $level) {
+ $post.='
'.chr(10).'
';
+ $i++;
+ $openLiTags--;
+ $openUlTags--;
+ }
+ $post.='';
+ }
+
+ $prelevel = $level;
+
+ $lines[$k]=$this->cObj->stdWrap($pre.substr($lines[$k],$level).$post,$conf['innerStdWrap.']);
}
-
+
// Set header type:
$type = intval($this->cObj->data['layout']);
-
+
// Compile list:
$out = '
';
-
+
// Calling stdWrap:
if ($conf['stdWrap.']) {
$out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
}
-
// Return value
return $out;
}