Uploaded image for project: 'JSPWiki'
  1. JSPWiki
  2. JSPWIKI-684

Improper interpretation of nested wiki plugin syntax in WYSIWYG mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.8.3
    • None
    • Editors
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kannanr Kannan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: