Changeset 2a386e2


Ignore:
Timestamp:
08/10/10 19:48:59 (4 years ago)
Author:
Aurélien Bompard <aurelien@…>
Branches:
master
Children:
6734727
Parents:
ebf3cf3
git-author:
Aurélien Bompard <aurelien@…> (08/10/10 19:48:59)
git-committer:
Aurélien Bompard <aurelien@…> (08/10/10 19:48:59)
Message:

Handle non-breaking spaces

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tests/data/1.xml

    reb18ea2 r2a386e2  
    316316Example: 
    317317</text:p> 
    318 <text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Preformatted_20_Text"> llama::<text:line-break/>   some kind of mammal, with hair<text:line-break/> ppython::<text:line-break/>   some kind of reptile, without hair<text:line-break/>   (can you spot the typo?)</text:p><text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Text_20_body"> 
     318<text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Preformatted_20_Text"> llama::<text:line-break/>   some kind of mammal, with hair<text:line-break/> ppython::<text:line-break/>   some kind of reptile, without hair<text:line-break/>   (can you spot the typo?)</text:p><text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Text_20_body"> 
    319319Display: 
    320320</text:p> 
     
    372372Display: 
    373373</text:p> 
    374 <text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Preformatted_20_Text"> def HelloWorld():<text:line-break/>     print "Hello World"</text:p><!--section level 2--> 
     374<text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Preformatted_20_Text"> def HelloWorld():<text:line-break/>     print "Hello World"</text:p><!--section level 2--> 
    375375<text:h xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Heading_20_2" text:outline-level="2">Blockquotes</text:h> 
    376376<text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Text_20_body"> 
     
    380380Example: 
    381381</text:p> 
    382 <text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Preformatted_20_Text">  This text is a quote from someone else.</text:p><text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Text_20_body"> 
     382<text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Preformatted_20_Text">  This text is a quote from someone else.</text:p><text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Text_20_body"> 
    383383Display: 
    384384</text:p> 
  • tests/test_block.py

    rebf3cf3 r2a386e2  
    3838        odt = xhtml2odt(html) 
    3939        print odt 
    40         assert str(odt) == '<?xml version="1.0" encoding="utf-8"?>\n<text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Preformatted_20_Text">   Line with spaces </text:p>\n' 
     40        # note: one of the spaces below is a non-breaking space, can you spot it ? ;-) 
     41        assert str(odt) == '<?xml version="1.0" encoding="utf-8"?>\n<text:p xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" text:style-name="Preformatted_20_Text">   Line with spaces </text:p>\n' 
    4142 
    4243    def test_pre4(self): 
  • xsl/document-content/block.xsl

    rebf3cf3 r2a386e2  
    103103            </xsl:call-template> 
    104104        </xsl:when> 
     105        <xsl:when test="contains($content, '  ')"> 
     106            <xsl:value-of select="substring-before($content, '  ')"/> 
     107            <xsl:text> &#xa0;</xsl:text> 
     108            <xsl:call-template name="pre.line"> 
     109                <xsl:with-param name="content" select="substring-after($content, '  ')"/> 
     110            </xsl:call-template> 
     111        </xsl:when> 
    105112        <xsl:otherwise> 
    106113            <xsl:value-of select="string($content)"/> 
Note: See TracChangeset for help on using the changeset viewer.