Improvement in xhtml->odt conversion (pod) + new search param for appy root classes and param 'indexed' for fields.

This commit is contained in:
Gaetan Delannay 2009-10-30 21:31:39 +01:00
parent cbd6fbbec5
commit 2b907fee32
11 changed files with 1742 additions and 1643 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
xhtmlInput = '''
<p>Champ FCK</p>
<ol>
<li>aaaa
<ol>
<li>Azerty</li>
<li>aaaa</li>
</ol>
</li>
<li>edzfrgh</li>
<li>Kupu</li>
</ol>
<table cellspacing="1" cellpadding="1" border="1" style="width: 210px; height: 66px;">
<tbody>
<tr>
<td>a</td>
<td>b</td>
</tr>
<tr>
<td>x</td>
<td>vvv</td>
</tr>
<tr>
<td>bbb</td>
<td>vvvvv</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p style="margin-left: 40px;">hghdghghgh</p>
<ul>
<li>aaa</li>
<li>&nbsp;</li>
<li>bvbb</li>
</ul>
<ol>
<li>regrg</li>
<li>&nbsp;</li>
</ol>
<p>vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù&nbsp; vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù</p>
<p>&nbsp;</p>
<p>vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù&nbsp; vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@èù vghriqghrghgfd&nbsp; hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&amp;é@</p>
'''

Binary file not shown.

Binary file not shown.

View file

@ -33,8 +33,8 @@ DEFAULT_ODT_STYLES = {'b': 'podBold', 'strong':'podBold', 'i': 'podItalic',
INNER_TAGS = ('b', 'strong', 'i', 'em', 'sup', 'sub', 'span', 'div')
TABLE_CELL_TAGS = ('td', 'th')
OUTER_TAGS = TABLE_CELL_TAGS + ('li',)
NOT_INSIDE_P = ('table', 'ol', 'ul') # Those elements can't be rendered inside
# paragraphs.
NOT_INSIDE_P = XHTML_HEADINGS + XHTML_LISTS + ('table',) # Those elements
# can't be rendered inside paragraphs.
NOT_INSIDE_LIST = ('table',)
IGNORABLE_TAGS = ('meta', 'title', 'style')
HTML_ENTITIES = {
@ -247,7 +247,7 @@ class XhtmlEnvironment(XmlEnvironment):
mustEndParagraph = True
if self.creatingRootParagraph:
mustStartParagraph = False
if currentElem and not (currentElem in XHTML_PARAGRAPH_TAGS):
if currentElem and (currentElem not in NOT_INSIDE_P+('p',)):
mustEndParagraph = False
if mustStartParagraph and mustEndParagraph and \
not self.currentContent.strip():