Improper interpretation of nested wiki plugin syntax in WYSIWYG mode
--------------------------------------------------------------------
Key: JSPWIKI-684
URL: https://issues.apache.org/jira/browse/JSPWIKI-684
Project: JSPWiki
Issue Type: Bug
Components: Editors
Affects Versions: 2.8.3
Reporter: Kannan
When using FCK editor(WYSIWYG mode) of JSPWiki and using an integrated plugin,
Table plugin especially, results in an improper formatting of the table and
also the original edited content of the plugin changed henceforth. This occurs
only when the plugin is being used with a nested plugin syntax:
[{Table style='border:3px solid #cccccc;'
|(text-align:center;font-weight:bold; background:#cccccc;) Hi dear Wiki.
|<
|<
| Date: [{CurrentTimePlugin format='dd:MMM:yyyy'}]
|Time: [{CurrentTimePlugin format='hh:mm:ss'}]
| This page: [{$pagename}]
| [{Table | Nested table | Nested table | Nested table | Nested table }]
|<
|< }]
The above example would not be formatted as expected in WYSIWYG mode and the
content would also be changed to:
[{Table style='border:3px solid #cccccc;'
|(text-align:center;font-weight:bold; background:#cccccc;) Hi dear Wiki.
|<
|<
| Date: [{CurrentTimePlugin format='dd:MMM:yyyy'}] \\ \\|Time:
[{CurrentTimePlugin format='hh:mm:ss'}] \\ \\| This page:
[{$pagename}] \\ \\| [{Table | Nested table | Nested table | Nested table |
Nested table }] \\ \\|< \\ \\|< }]
after update.
This is because of the html to wiki markup conversion of WYSIWYG. The issue
persists in the html element to wiki markup conversion of WYSIWYG in the
JSPWiki engine. Two backslashes "\\" (a line break in wiki) would be introduced
for a `<br/>' tag. Though in the final flush stage it would be replaced to
`\n', the issue persists. This is because the plugin text is matched via the
regex:
<snip>
"\\{\\{\\{(.*?)\\}\\}\\}|\\{\\{(.*?)\\}\\}|\\[\\{(.*?)\\}\\]"
</snip>
and this regex can't handle recursive wiki plugin syntax as quoted in the
example above and would not match the whole wiki content.
So, the translation would occur for all of the WYSIWYG editor content, but the
replacement of backslashes could occur only partially and hence the
backslashes(introduced by the html to wiki translator) could not be replaced
into `\n' as required and hence we get `\\' between the wiki text. Hence, in
the table plugin example quote we get `\\' between content owing to nested
plugin usage.
The same nested syntax problem exists for the pre-formatted text syntax of
wiki `{{{' and `{{' too. FWIW, all these would work out of the box with plain
editor.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira