Uploaded image for project: 'Maven Doxia'
  1. Maven Doxia
  2. DOXIA-467

Confluence: Inconsistent handling of '\' escape characters, incorrect handling of \\ inside {{monospace}} blocks.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3
    • 1.4
    • Module - Confluence
    • None
    • Patch

    Description

      I noticed that our generated pages are mostly nonsense where we have \\unc\path\strings and also some general DOS-style paths (c:\dos\run). The issue is that \ are "eaten" because they are treated as escape characters and get suppressed from output. This is incorrect, per Confluence rules, they should appear almost always, and only function as escapes when directly preceding _ and * characters with special meaning (note, in Confluence they also have + and - and ^ and ~ with special meaning, it would be used to escape them too, but we don't have that yet).

      The other issue is with
      , confluence actually does not support line breaks within the line (it seems to me), and only forces linebreak if
      appears at the end of line. This makes sense, because otherwise writing \\unc\path is impossible (as you can't quite escape the '
      ' with another '\'). I haven't yet looked how feasible it is to make
      only work as line break if it appears at the end of line, but my requirement was simpler: to make
      work inside monospace blocks, i.e., make it appear verbatim, and not produce linebreak. So that \\unc\path can be written and appear so.

      I want to also propose to make handling of italic less zealous, as we happen to have a lot of code variables that use underscore (variables_like_this), and currently the underscores get eaten, and (like) part gets italicized. (Escaping all underscores is not practical.)
      I wish to propose that italic modifier _ should only work if preceded by whitespace or * (+ some other edge cases). So this should get italicized but something_like_this would not.

      (You can actually see the above work right here in this comment, as JIRA parses this text according to Confluence rules. We should strive to replicate this behaviour, as I see one use-case of this module is to transfer wiki pages created in Confluence into source tree as documentation. That does not work if our implementation does not faithfully render markup as Confluence wiki would).

      I am attaching a proposed patch.
      (Sorry this patch also includes lines for DOXIA-466, I don't know how to remove them. So if you already applied that patch, you will get some rejected hunks).

      Another part is that * and _ are always produced verbatim in monospace blocks.

      Attachments

        1. confluence-escaping-hg.patch
          18 kB
          Valters Vingolds
        2. confluence-escaping-patch-files.zip
          9 kB
          Valters Vingolds
        3. monospace-escapes.patch
          15 kB
          Valters Vingolds

        Activity

          People

            rfscholte Robert Scholte
            valters Valters Vingolds
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: