Improvement in xhtml->odt conversion (pod) + new search param for appy root classes and param 'indexed' for fields.
This commit is contained in:
parent
cbd6fbbec5
commit
2b907fee32
11 changed files with 1742 additions and 1643 deletions
3177
pod/test/Tests.rtf
3177
pod/test/Tests.rtf
File diff suppressed because it is too large
Load diff
44
pod/test/contexts/XhtmlComplex4.py
Normal file
44
pod/test/contexts/XhtmlComplex4.py
Normal 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> </p>
|
||||
<p style="margin-left: 40px;">hghdghghgh</p>
|
||||
<ul>
|
||||
<li>aaa</li>
|
||||
<li> </li>
|
||||
<li>bvbb</li>
|
||||
</ul>
|
||||
<ol>
|
||||
<li>regrg</li>
|
||||
<li> </li>
|
||||
</ol>
|
||||
<p>vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù</p>
|
||||
<p> </p>
|
||||
<p>vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@èù vghriqghrghgfd hgkll hgjkf lghjfkd slhgjfd klhgjfds klghjfds s&é@</p>
|
||||
'''
|
BIN
pod/test/results/xhtmlComplex4.odt
Normal file
BIN
pod/test/results/xhtmlComplex4.odt
Normal file
Binary file not shown.
BIN
pod/test/templates/XhtmlComplex4.odt
Executable file
BIN
pod/test/templates/XhtmlComplex4.odt
Executable file
Binary file not shown.
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue