Page MenuHomePhabricator

Excess </dd> tags are generated
Closed, DeclinedPublic

Description

Author: haridara

Description:
I am using colon (:) to prefix the list items such that I will get an extra indentation (I don't like <blockquote> as it gives too much indentation). This seems to rather work very well, but I consistently see extra </dd> getting generated and no matter how I try to remove them, they come back when I save (even if they don't exist in the preview). Here is an example (wikitext):

Here are some fruits:
:* apples
:* bananas
:* oranges
<<<<

Turn off wikitext and see nicely formatted text such as:

Here are some fruits:

  • apples
  • bananas
  • oranges

<<<<

Now switch back to Wikitext you start seeing the excess </dd> tags. In this case you will see:

Here are some fruits:
<dl><dd>

<br> <br>

  • apples
  • bananas
  • oranges

&lt;/dd&gt;
</dd></dl>
<<<<

Every time you switch back and forth, you would see an extra </dd> getting added. Of course, the colon prefix has nothing to do with this behavior as you would see this even if you started like the below in the first place:

Here are some fruits:
<dl><dd>

  • apples
  • bananas
  • oranges

</dd></dl>
<<<<

The problem seems to be fundamental to the parsing of <dd></dd> tags, try this and you will see the same extra </dd> tags:

Here are some fruits:
<dd>

  • apples
  • bananas
  • oranges

</dd>
<<<<


Version: 1.11.x
Severity: normal

Details

Reference
bz12628

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 10:01 PM
bzimport set Reference to bz12628.
bzimport added a subscriber: Unknown Object (MLST).

Are you using a WYSIWYG editor like FCKeditor? It sounds like you are switching back and forth between wikitext and HTML without saving and reediting the page. Is that right? If so, the bug probably needs to be filed with the WYSIWYG dev team.

haridara wrote:

Yes, we do have FCKeditor configured and I realized that soon after I submitted the report so I went into the preferences and disabled the editing option "Enable section editing by right clicking on section titles (JavaScript)" and went back to try it. What I can see is that as soon as I click on Preview button, the extra </dd> gets added, so this problem is not specific to WYSIWYG editor.

To workaround, I am now using <ul> around the list instead of prefixing with colons. When I tried this earlier with WYSIWYG editor, I got into a different kind of problem which is gone when I disabled the above option. The problem with <ul> and WYSIWYG is that though it would look fine in the preview, after submission, it would add an extra bullet to the first item alone, so something like the below:

Here are some fruits:
<ul>

  • apples
  • bananas
  • oranges

</ul>
<<<<

would look more like this in the preview:

Here are some fruits:

  • * apples
    • bananas
    • oranges

<<<<

If I switch back to wikitext it would end up as below

Here are some fruits:

  • apples
  • bananas
  • oranges

<<<<

Strangely, though the <ul> tags are missing, switching to the preview (or saving) would continue to show the extra bullet (and the indenting is preserved too).

(In reply to comment #2)

Yes, we do have FCKeditor configured and I realized that soon after I submitted
the report so I went into the preferences and disabled the editing option
"Enable section editing by right clicking on section titles (JavaScript)" and
went back to try it. What I can see is that as soon as I click on Preview
button, the extra </dd> gets added, so this problem is not specific to WYSIWYG
editor.

That option in preferences doesn't have anything to do with FCKeditor. If you have a preference called "disable rich text editor" or something like that, that's the one you want to check. Following the steps in your initial description with a clean installation of 1.11 (with no extensions installed) doesn't cause the problem you are seeing so this is definitely a problem with FCKeditor.

The problem is that FCKeditor is dynamically converting your wikitext into HTML and back every time you click on the "wikitext" or "html" buttons in the editing toolbox. It uses its own parser to do this, not the MediaWiki parser, so the results aren't perfect. You have a couple options here:

  1. You can disable FCKeditor.
  2. You can try to fix the FCKeditor parser javascript so that it doesn't keep adding <dd>s everytime it parses an indentation.
  3. You can submit a bug to the FCKeditor team and hope they can fix it. http://dev.fckeditor.net/report/12

Actually, it looks like the FCKeditor team is aware of the bug and has it fixed in one of their newer builds. See http://dev.fckeditor.net/ticket/1003. Try upgrading your FCKeditor code to the latest version and see if that does the trick.

ayg wrote:

(In reply to comment #2)

Yes, we do have FCKeditor configured and I realized that soon after I submitted
the report so I went into the preferences and disabled the editing option
"Enable section editing by right clicking on section titles (JavaScript)" and
went back to try it. What I can see is that as soon as I click on Preview
button, the extra </dd> gets added, so this problem is not specific to WYSIWYG
editor.

I can't reproduce. Inputting the text

:* apples
:* bananas
:* oranges

produces the expected result, i.e., a <dl><dd><ul><li>...</li><li>...</li><li>...</li></ul></dd></dl>.

To workaround, I am now using <ul> around the list instead of prefixing with
colons. When I tried this earlier with WYSIWYG editor, I got into a different
kind of problem which is gone when I disabled the above option. The problem
with <ul> and WYSIWYG is that though it would look fine in the preview, after
submission, it would add an extra bullet to the first item alone, so something
like the below:

Here are some fruits:
<ul>

  • apples
  • bananas
  • oranges

</ul>
<<<<

would look more like this in the preview:

Here are some fruits:

  • * apples
    • bananas
    • oranges

<<<<

This behavior is expected. If you wrap a wiki list inside an HTML list, you'll have a list nested inside a list. You want either

  • apples
  • bananas
  • oranges

or

<ul>
<li>apples</li>
<li>bananas</li>
<li>oranges</li>
</ul>

Resolving WORKSFORME. Please reopen if you can find an issue with MediaWiki itself with no external editors, JavaScript widgets, or any other third-party addition.

haridara wrote:

I copy pasted a wrong preference name. The preference that I played it with was "Show edit toolbar (JavaScript)". When I disabled it, the editor toolbar was gone and I had to explicitly click on the preview button to see the change in action. I did find a preference for disabling rich-text editor and that seems to have solved the problem with the </dl> tags, so you are right that it is a problem with FCKEditor.

Regarding the second problem:

would look more like this in the preview:

Here are some fruits:

  • * apples
    • bananas
    • oranges

<<<<

This behavior is expected. If you wrap a wiki list inside an HTML list, you'll
have a list nested inside a list. You want either

  • apples
  • bananas
  • oranges

or

<ul>
<li>apples</li>
<li>bananas</li>
<li>oranges</li>
</ul>

Not sure what you mean by it is expected. With using <li>, the <ul> tag works fine for me now. The problem that I reported seems to be with, again, FCKEditor.

Thanks for looking into the issue, I will keep rich-text editor disabled.