Uploaded image for project: 'Wiki Editor Tools'
  1. Wiki Editor Tools
  2. WIKIEDITOR-50

Syntax Highlighting breaks the wiki editor in Space Delimited code (python macro)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.2
    • Component/s: Syntax Highlighting
    • Labels:
    • Environment:
      Xwiki 9.6/9.7, syntax highlighting application 4.0
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      Assuming the following code:

      {{python}}
        square = 1
        pennies = 1
      
        while square <= 64:
            print "Square: %s Pennies: %s" % (square, square)
            if square == 1:
                quantity = "penny"
            else:
                quantity = "pennies"
      
            print "As of square %s you have %s %s." % (square, pennies, quantity)
            print ""
            square += 1
            pennies += square
      {{/python}}
      

      Highlighting works (in the wiki/code view), but parsing the script fails. Change the first line (square) to have no leading spaces, and the entire script 'vanishes'. Remove the extra spaces from the rest of it, and it will work again, but you won't be able to see the script without juggling through views to confuse the highlighter.

      As ruby is also tab/space delimited, ruby will most likely break with the same constraint. Looking at the documentation, all of the examples show the 2 spaces initial padding inside the code macro.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                enygma Eduard Moraru
                Reporter:
                daemoen Marc Mercer
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: