GUI-Editor Don't Allow <<BR>> in tables

When using the GUI editor, if the user press <enter> to force a line-feed inside a table cell, moinmoin will remove this linefeed when saving.

See also, see MoinMoinBugs/GuiEditor#line-break-problem

Steps to reproduce

  1. Edit a page in GUI mode.
  2. Create a new table
  3. Inside any cell of that table, type something, then enter, then some more text, like * Orange<ENTER>* Apples.

Example

* Orange * Apples

Component selection

Details

MoinMoin Version

1.8.2

OS and Version

Debian Sid

Python Version

2.5

Server Setup

Apache/CGI

Server Details

Language you are using the wiki in (set in the browser/UserPreferences)

French

Workaround

Use the Text editor to type <<BR>> when you want line breaks.

Discussion

Here's a patch : moin_support_br_in_table.diff

   1 --- a/MoinMoin/converter/text_html_text_moin_wiki.py    2009-03-01 17:47:50.000000000 +0100
   2 +++ b/MoinMoin/converter/text_html_text_moin_wiki.py    2009-03-01 17:47:55.000000000 +0100
   3 @@ -1154,9 +1154,14 @@
   4              self.text.append("<%s>" % style)
   5  
   6          found = False
   7 +        c = 0
   8          for i in node.childNodes:
   9              name = i.localName
  10              if name == 'p':
  11 +                c += 1
  12 +                # Moin don't support multiple paragraph inside a table. simulate it with a br.
  13 +                if c > 1:
  14 +                    self.text.append('<<BR>>')
  15                  self.process_paragraph_item(i)
  16                  self.text.append(self.white_space)
  17                  found = True

-- FranklinPiat 2009-03-01 20:56:36

Thanks for the patch some notes

  1. not necessary to use brackets (c > 1)

  2. indenting is wrong in the line after "if (c > 1) ..."

  3. do you have called py.test and checked the tests?

I have fixed the patch, as suggested. The test test_text_html_text_moin_wiki.py prints the following message:

MoinMoin/converter/_tests/test_text_html_text_moin_wiki.py[94] ..ss........ssss...ssssssssssssssssss.s.s...sssssssssssssssssssssssssssss.ss..................

See also the bug: MoinMoinBugs/GuiEditorShiftEnterBreaksTables

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/GuiEditorDontAllowBrInTables (last edited 2009-03-02 07:25:40 by FranklinPiat)