Add suport for definition lists

This commit is contained in:
Kovid Goyal 2007-07-10 17:53:45 +00:00
parent ceb2c36f66
commit dae41f4e40
3 changed files with 19 additions and 2 deletions

View File

@ -13,7 +13,7 @@
## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
''' E-book management software'''
__version__ = "0.3.66"
__version__ = "0.3.67"
__docformat__ = "epytext"
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
__appname__ = 'libprs500'

View File

@ -1033,7 +1033,7 @@ class HTMLConverter(object):
pass
self.end_current_block()
self.current_block = self.book.create_text_block()
elif tagname in ['ul', 'ol']:
elif tagname in ['ul', 'ol', 'dl']:
self.in_ol = 1 if tagname == 'ol' else 0
self.end_current_block()
self.current_block = self.book.create_text_block(
@ -1053,6 +1053,15 @@ class HTMLConverter(object):
self.process_children(tag, tag_css)
if self.in_ol:
self.in_ol += 1
elif tagname in ['dt', 'dd']:
if self.current_para.has_text():
self.current_para.append(CR())
self.current_block.append(self.current_para)
self.current_para = Paragraph()
self.current_para.append(Space(xsize=100))
if tagname == 'dd':
self.current_para.append(Space(xsize=200))
self.process_children(tag, tag_css)
elif tagname == 'blockquote':
self.current_para.append_to(self.current_block)
self.current_block.append_to(self.current_page)

View File

@ -42,6 +42,14 @@
<p>
Note that nested lists are not supported.<br />
</p>
<p></p>
<h3>Definition Lists</h3>
<dl>
<dt>Term 1</dt>
<dd>Definition of Term 1</dd>
<dt>Term 2</dt>
<dd>Definition of Term 2</dd>
</dl>
<p class='toc'>
<hr />
<a href='#toc'>Table of Contents</a>