Details
Applies to
1.8.4
Purpose
Removes a bug where empty list elements in the GUI editor will lead to "* * * * *..." characters after saving the GUI editor content.
If you enter some empty list elements in the GUI editor by pressing ENTER again and again and you press "save changes" after that, your empty list items are converted to "* * * * * * ..." (the wiki markup for list elements). In my opinion this is a bug which can be fixed very easily.
Try it yourself. Type this:
- first line
- second line
- third line
After that insert some empty list elements before "first line" through pressing the ENTER key several times. You will see some empty bullets. After saving your changes it will look like this:
- * * * first line
- second line
- third line
Description
This patch patches the file text_html_text_moin_wiki.py
Patch
Empty list elements like <li></li> are transformed to the wiki markup "*" without a line break in the file 'text_html_text_moin_wiki.py'.
The code lines
if node.childNodes.length == 0: self.text.append(self.new_line) return
will append empty list elements with a line break. The procedure "process_list_item" will look like this after the modification (partially shown only):
def process_list_item(self, node, indent): found = False need_indent = False pending = [] if node.childNodes.length == 0: self.text.append(self.new_line) return for i in node.childNodes: name = i.localName if name in ('p', 'pre', 'ol', 'ul', 'dl', 'table', ) and pending: self.empty_paragraph_queue(pending, indent, need_indent) need_indent = True ...
And here is the patch file:
1 # HG changeset patch
2 # User Josef Meier (jo.meier@gmx.de)
3 # Date 1250020302 -7200
4 # Node ID 1d407a2b8aff4be154f89c1ee5442384f13124d1
5 # Parent a6cffa0032be9a6ea4ee310e72e53829de6bd699
6 Fixes a bug with empty list items in the GUI editor.
7 See also http://www.moinmo.in/MoinMoinPatch/GuiRemoveEmptyListItems
8
9 diff -r a6cffa0032be -r 1d407a2b8aff MoinMoin/converter/text_html_text_moin_wiki.py
10 --- a/MoinMoin/converter/text_html_text_moin_wiki.py Tue Aug 11 21:50:33 2009 +0200
11 +++ b/MoinMoin/converter/text_html_text_moin_wiki.py Tue Aug 11 21:51:42 2009 +0200
12 @@ -682,6 +682,12 @@
13 found = False
14 need_indent = False
15 pending = []
16 +
17 + # If this is a empty list item, we just terminate the line
18 + if node.childNodes.length == 0:
19 + self.text.append(self.new_line)
20 + return
21 +
22 for i in node.childNodes:
23 name = i.localName
24
Discussion
Plan
- Priority:
- Assigned to:
Status: fixed by http://hg.moinmo.in/moin/1.8/rev/d5d9ef80d39b