Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-6059

Checking if content is html

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 2.2 RC1
    • Old Core
    • None
    • Unknown

    Description

      XWikiDocument.display:

      if (isInRenderingEngine && !is10Syntax(syntaxId)
        && (result.indexOf("<") != -1 || result.indexOf(">") != -1)) {
          result.insert(0, "{{html clean=\"false\" wiki=\"false\"}}");
          result.append("{{/html}}");
      }
      

      Add check for '&', e.g. to handle &nbsp;

      I would need such a function in another place too, so maybe it could be defined as utility function, such as HtmlUtil.isHtml(StringBuffer) + HtmlUtil.isHtml(String)

      Or perhaps HtmlUtil.isNotHtml would be more appriopriate... because if string doesn't contain any of <>& then it is not html, but if it does it not necessarily is (e.g. "M&M")

      Attachments

        Activity

          People

            Unassigned Unassigned
            lskowronski ?ukasz Skowro?ski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: