Ticket #665 (closed defect: fixed)

Opened 6 years ago

Last modified 3 years ago

Incorrect rendering of nested lists

Reported by: DarTar Owned by: TormodHaugen
Priority: high Milestone: 1.3.1
Component: formatters Version: 1.1.6.4-rc1
Severity: major Keywords: 1.1.7-ported, lists
Cc: fishy, DotMG

Description

(reported by fishy on wikka-community)

Hi, folks. I've updated to 1.1.6.4-RC1, and found that the indented list rendering is error.

Here's the page:  http://yhsif.com/HomePage

the wiki source is like this:

====
~1) list item number 1
~1) list item number 2
~~- indented bullet item number 1
~~- indented bullet item number 2
~1) list item number 3
====

it works fine in 1.1.6.3, like this:

====
1. list item number 1
2. list item number 2
	* indented bullet item number 1
	* indented bullet item number 2
3. list item number 3
====

but in 1.1.6.4-RC1, it becomes:

====
1. list item number 1
2. list item number 2
*	* indented bullet item number 1
	* indented bullet item number 2
1. list item number 3
====

As you can notice, there's a unneeded bullet before "indented bullet item number 1", and the list number for "list item number 3" rolled back to 1.

Change History

  Changed 6 years ago by DotMG

  • owner changed from unassigned to DotMG
  • status changed from new to assigned

  Changed 6 years ago by DarTar

(this also applies to trunk)

follow-up: ↓ 4   Changed 6 years ago by PaulP

I'm new to PHP, so take this with a large grain of salt -- I believe there are two problems:

1) The closers are being popped any time that indent level and indent type changes, rather than only if the indent level is being increased (ie, outdenting) and type is changing.
2) The For loop is popping all closers rather than only those back to the $newIndentLevel

Lines 353-378:

               // get new indent level 
                        $newIndentLevel = strlen($matches[2]); 
                        if (($newIndentType != $curIndentType) && ($oldIndentLevel > 0)) 
                        { 
                                for (; $oldIndentLevel > 0; $oldIndentLevel --) 
                                { 
                                        $result .= array_pop($indentClosers); 
                                } 
                        } 
                        if ($newIndentLevel > $oldIndentLevel) 
                        { 
                                for ($i = 0; $i < $newIndentLevel - $oldIndentLevel; $i++) 
                                { 
                                        $result .= $opener; 
                                        array_push($indentClosers, $closer); 
                                } 
                        } 
                        else if ($newIndentLevel < $oldIndentLevel) 
                        { 
                                for ($i = 0; $i < $oldIndentLevel - $newIndentLevel; $i++) 
                                { 
                                        $result .= array_pop($indentClosers); 
                                } 
                        } 
 
                        $oldIndentLevel = $newIndentLevel;

can become:

 	 	 // get new indent level
	 	 	 $newIndentLevel = strlen($matches[2]);
	 	 	 if ($newIndentLevel > $oldIndentLevel)
	 	 	 {
	 	 	 	 for ($i = 0; $i < $newIndentLevel - $oldIndentLevel; $i++)
	 	 	 	 {
	 	 	 	 	 $result .= $opener;
	 	 	 	 	 array_push($indentClosers, $closer);
	 	 	 	 }
	 	 	 }
	 	 	 else if ($newIndentLevel < $oldIndentLevel)
	 	 	 {
                                 if (($newIndentType != $curIndentType) && ($oldIndentLevel > 0))   
                                 {
                                     for (; $oldIndentLevel > $newIndentLevel; $oldIndentLevel --) 
                                     {
                                         $result .= array_pop($indentClosers);
                                     }
                                 }             
	 	 	 	 for ($i = 0; $i < $oldIndentLevel - $newIndentLevel; $i++)
	 	 	 	 {
	 	 	 	 	 $result .= array_pop($indentClosers);
	 	 	 	 }
	 	 	 }

	 	 	 $oldIndentLevel = $newIndentLevel;

in reply to: ↑ 3   Changed 6 years ago by PaulP

should have said:

1) The closers are being popped any time that indent level and indent type changes, rather than only if the indent level is being decreased (ie, outdenting) and type is changing.
2) The For loop is popping all closers rather than only those back to the $newIndentLevel.

  Changed 6 years ago by DotMG

(In [963]) This is a half and quick-fix. The problem of list rendering is more important and I think they could be fixed completely with 1.1.7

refs #665

  Changed 6 years ago by DarTar

Mahefa, it seems the list now renders correctly, but the list elements are not properly closed, using fishy's example I now get:

<ol type="1">
<li> list item number 1</li>
<li> list item number 2<ul><li> indented bullet item number 1</li><li> indented bullet item number 2</li></ul></li>
<li> list item number 3

the closing </li> and </ol> are missing. Adding an extra line after the list in fishy's example resolves the issue. I think this issue has already been fixed in trunk, maybe we should port some code from the formatter.

  Changed 6 years ago by DarTar

  • summary changed from Incorrect rendering of lists to Incorrect rendering of nested lists

  Changed 6 years ago by DotMG

(In [969]) Backporting [475] to 1.1.6.4, See #444, #665

refs #665

  Changed 6 years ago by DarTar

  • status changed from assigned to closed
  • resolution set to fixed

works fine for me after [969], thanks.

  Changed 6 years ago by DarTar

  • keywords 1.1.7-ported added

This seems to be already fixed in trunk

  Changed 5 years ago by TormodHaugen

  • status changed from closed to reopened
  • resolution fixed deleted
  • milestone changed from 1.1.6.4 to 1.1.6.6

Nested lists still render wrong. The problem is that the parent list is closed, and the new list is opened twice. In addition; new lists are opened within a li tag that isn't closed.

Example:  http://docs.wikkawiki.org/WikkaInstallation#hn_Installation_problems

  Changed 5 years ago by TormodHaugen

  • owner changed from DotMG to TormodHaugen
  • status changed from reopened to assigned

  Changed 5 years ago by TormodHaugen

  • status changed from assigned to started

  Changed 5 years ago by TormodHaugen

  • keywords 1.1.7-ported, lists added; 1.1.7-ported removed
  • status changed from started to accepted
  • milestone changed from 1.1.6.6 to 1.1.7

  Changed 5 years ago by TormodHaugen

  • status changed from accepted to testing

Fix submitted for trunk in changeset [1257].

  Changed 5 years ago by DarTar

Retargeting to 1.3. Code for this ticket has already been committed to trunk, from which 1.3 will be branched. Consider backporting urgent issues to 1.2.X

  Changed 5 years ago by DarTar

  • milestone changed from 1.2 to 1.3

  Changed 4 years ago by BrianKoontz

  • status changed from testing to commit

Tested in 1.3. At some point, the trunk changes were pulled into 1.3 (probably because the original wakka.php file in the 1.3 branch was replaced by trunk). At any rate, all changes are present and accounted for, and the "double bullet" problem is resolved.

  Changed 4 years ago by BrianKoontz

  • status changed from commit to closed
  • resolution set to fixed

  Changed 3 years ago by BrianKoontz

  • milestone changed from 1.3 to 1.3.1

Updated milestone to 1.3.1

Note: See TracTickets for help on using tickets.