XWiki Platform
  1. XWiki Platform
  2. XWIKI-5591

HTML to Wiki Syntax 2 looses color in certain cases

    Details

    • Tests:
      Unit
    • Difficulty:
      Medium
    • Similar issues:
      XWIKI-3670When switching from syntax 1 to syntax 2 a $doc.name / $doc.web is encapsulated in a {{velocity}} marker but also in a {{html wiki=true}} marker
      XWIKI-5979OpenOffice fails to restart in certain cases
      XWIKI-2269\\\\\ in wiki syntax does not convert to 2 <br /> but instead escaped one \ in HTML
      XWIKI-3743new problem with {{velocity}}+{{html}} (certainly since {{html wiki="false"}} by default)
      XWIKI-1599Using HTML in Wiki Syntax creates invalid HTML in rendering
      XWIKI-4613Macros that output STYLE tags inside the HTML body generate wiki syntax garbage
      XWIKI-322If I put HTML code inside text in wiki editor mode, and I switch to wysiwyg mode, I loose this code
      XWIKI-1152Wysiwyg loosing content when copy pasting and switching to list
      XWIKI-398Allowing to change font size, type and color.
      XWIKI-5654Feed plugin does write HTML tags in document titles

      Description

      In certain cases some styles will be lost in HTML to Syntax 2.0 conversion
      This content

      <html>
      <body>
      <font style="color: #ff0000"><span lang="fr-FR"><b>Hello</b></span></font>
      <span style="color: #ff0000"><span lang="fr-FR"><b>Hello</b></span></span>
      <span style="color: #ff0000"><b>Hello</b></span>
      </body>
      </html>
      

      Converts to:

      (% lang="fr-FR" %)**Hello**(%%) 
      (% lang="fr-FR" %)**Hello**(%%) 
      (% style="color: #ff0000" %)**Hello** 
      

      The first 2 lines don't keep the color style while the last one does.
      This is particularly problematic because the first line is an example coming from an OpenOffice conversion

        Issue Links

          Activity

          Hide
          Thomas Mortagne added a comment -

          It has nothing to do with color, pretty sure the parser simply does not take into account font element or something.

          Show
          Thomas Mortagne added a comment - It has nothing to do with color, pretty sure the parser simply does not take into account font element or something.
          Hide
          Thomas Mortagne added a comment -

          According to http://validator.w3.org font is not valid xhtml element.

          Show
          Thomas Mortagne added a comment - According to http://validator.w3.org font is not valid xhtml element.
          Hide
          Ludovic Dubost added a comment -

          Let's forget the font element for now as I think we have a pretreatment in the office import module.
          But look at the second line

          <span style="color: #ff0000"><span lang="fr-FR"><b>Hello</b></span></span>
          

          Only the "lang" param stays in the end: (% lang="fr-FR" %)*Hello*(%%)
          This does not sound normal to me.

          Show
          Ludovic Dubost added a comment - Let's forget the font element for now as I think we have a pretreatment in the office import module. But look at the second line <span style= "color: #ff0000" ><span lang= "fr-FR" ><b>Hello</b></span></span> Only the "lang" param stays in the end: (% lang="fr-FR" %)* Hello *(%%) This does not sound normal to me.
          Hide
          Ludovic Dubost added a comment -

          Here is the exact content that I managed to get out of the office importer module:

          <p class="western" style="margin-bottom: 0cm">This is a test with <span style="color:#ff0000;"><span lang="en-US">red</span></span>
          in two <span style="color:#ff0000;">different</span> ways.</p>
          
          Show
          Ludovic Dubost added a comment - Here is the exact content that I managed to get out of the office importer module: <p class= "western" style= "margin-bottom: 0cm" >This is a test with <span style= "color:#ff0000;" ><span lang= "en-US" >red</span></span> in two <span style= "color:#ff0000;" >different</span> ways.</p>
          Hide
          Thomas Mortagne added a comment -

          This does not sound normal to me.

          I never said it was normal, i would have closed this issue. I only commented the font part.

          Show
          Thomas Mortagne added a comment - This does not sound normal to me. I never said it was normal, i would have closed this issue. I only commented the font part.
          Hide
          Thomas Mortagne added a comment -

          Done. Note that i did not do anything for font element.

          Show
          Thomas Mortagne added a comment - Done. Note that i did not do anything for font element.
          Show
          Thomas Mortagne added a comment - See http://code.google.com/p/wikimodel/issues/detail?id=196
          Hide
          Ludovic Dubost added a comment -

          This seems to still fail in this example:

          <span style="color:#ff0000;"><span style="font-family:Arial, sans-serif;"><span style="font-size:1.0em;"><span lang="fr-FR">test</span></span></span></span>
          

          Result is:

          (% style="font-size:1.0em;" lang="fr-FR" %)test

          Seems like only the first two levels are used here

          Show
          Ludovic Dubost added a comment - This seems to still fail in this example: <span style= "color:#ff0000;" ><span style= "font-family:Arial, sans-serif;" ><span style= "font-size:1.0em;" ><span lang= "fr-FR" >test</span></span></span></span> Result is: (% style="font-size:1.0em;" lang="fr-FR" %)test Seems like only the first two levels are used here
          Hide
          Thomas Mortagne added a comment -

          No it's because there is two style attribute to merge, i will take care of this.

          Show
          Thomas Mortagne added a comment - No it's because there is two style attribute to merge, i will take care of this.

            People

            • Assignee:
              Thomas Mortagne
              Reporter:
              Ludovic Dubost
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

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