Ignore:
Timestamp:
07/14/11 13:30:27 (23 months ago)
Author:
Aurélien Bompard <aurelien@…>
Branches:
master
Children:
56b06fd
Parents:
fb98182
git-author:
Aurélien Bompard <aurelien@…> (07/14/11 13:30:27)
git-committer:
Aurélien Bompard <aurelien@…> (07/14/11 13:30:27)
Message:

Add specific rendering code for Elyxer

Exlyxer <http://elyxer.nongnu.org/> is a LyX to HTML converter. This
commit adapts to its use of div tags instead of p tags.

Thanks to Denis Prost for reporting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test_specific.py

    r61a9b94 rf2fad80  
    106106 
    107107 
     108class SpecificElyxer(unittest.TestCase): 
     109 
     110    def test_div_standard(self): 
     111        html = ('<html xmlns="http://www.w3.org/1999/xhtml">' 
     112                '<div id="globalWrapper">' 
     113                '<div class="Standard">Test</div>' 
     114                '</div></html>') 
     115        odt = xhtml2odt(html) 
     116        self.assertEquals(odt, 
     117                '<text:p text:style-name="Text_20_body">Test</text:p>') 
     118 
     119    def test_div_addsec(self): 
     120        html = ('<html xmlns="http://www.w3.org/1999/xhtml">' 
     121                '<div id="globalWrapper">' 
     122                '<div class="Addsec">Test</div>' 
     123                '</div></html>') 
     124        odt = xhtml2odt(html) 
     125        self.assertEquals(odt, 
     126                '<text:p text:style-name="Text_20_body">Test</text:p>') 
     127 
     128    def test_div_description(self): 
     129        html = ('<html xmlns="http://www.w3.org/1999/xhtml">' 
     130                '<div id="globalWrapper">' 
     131                '<div class="Description">Test</div>' 
     132                '</div></html>') 
     133        odt = xhtml2odt(html) 
     134        self.assertEquals(odt, 
     135                '<text:p text:style-name="Text_20_body">Test</text:p>') 
     136 
     137    def test_div_subject(self): 
     138        html = ('<html xmlns="http://www.w3.org/1999/xhtml">' 
     139                '<div id="globalWrapper">' 
     140                '<div class="Subject">Test</div>' 
     141                '</div></html>') 
     142        odt = xhtml2odt(html) 
     143        self.assertEquals(odt, 
     144                '<text:p text:style-name="Title">Test</text:p>') 
     145 
     146    def test_div_subtitle(self): 
     147        html = ('<html xmlns="http://www.w3.org/1999/xhtml">' 
     148                '<div id="globalWrapper">' 
     149                '<div class="Subtitle">Test</div>' 
     150                '</div></html>') 
     151        odt = xhtml2odt(html) 
     152        self.assertEquals(odt, 
     153                '<text:p text:style-name="Subtitle">Test</text:p>') 
     154 
     155    def test_footnote(self): 
     156        html = ('<html xmlns="http://www.w3.org/1999/xhtml">' 
     157                '<div id="globalWrapper"><p>Main text' 
     158                  '<span class="FootOuter">' 
     159                    '<span class="SupFootMarker"> [A] </span>' 
     160                    '<span class="HoverFoot">' 
     161                      '<span class="SupFootMarker"> [A] </span>' 
     162                      'Note content' 
     163                    '</span>' 
     164                  '</span>' 
     165                '</p></div></html>') 
     166        odt = xhtml2odt(html) 
     167        self.assertEquals(odt, '<text:p text:style-name="Text_20_body">' 
     168            'Main text<text:note text:note-class="footnote"><text:note-body>' 
     169            '<text:p text:style-name="Footnote">Note content</text:p>' 
     170            '</text:note-body></text:note></text:p>') 
     171 
     172 
     173 
    108174if __name__ == '__main__': 
    109175    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.