JTidy doesn't correctly parse balanced angle brackets inside XML comments (<!-- ... -->). Angle brackets should be allowed as literals in this case [1], but JTidy does not do this properly.

      To replicate this, create a user macro with the following content:

      <script>
      <!--
      if (4 < 5 && 3 > 2) alert("Oops.");
      // -->
      </script>

      Include the user macro in a page, and export it to PDF. The part of the user macro following the greater-than sign is included in the PDF text.

      The same bug exists for CDATA sections and browsers do not seem to understand correctly-escaped Javascript using > and <, at least in HTML 4.0 mode.

      A workaround is to remove the greater-than sign (>) by using a negative condition.

      if (4 < 5 && !(3 <= 2)) alert("Oops.");

      This was identifed by a plugin author attempting to put commented Javascript in his Velocity template [2].

      [1] http://www.w3.org/TR/REC-xml/#sec-comments
      [2] http://forums.atlassian.com/thread.jspa?messageID=257229977

            [CONFSERVER-6490] PDF export breaks with angle brackets inside comments

            No work has yet been logged on this issue.

              mjensen m@ (Inactive)
              matt@atlassian.com Matt Ryall
              Affected customers:
              5 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: