mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Support superscripts and subscripts. Fixes #157.
This commit is contained in:
parent
40d13ecac5
commit
0128e3bb01
@ -35,7 +35,7 @@ from libprs500.ebooks.BeautifulSoup import BeautifulSoup, Comment, Tag, \
|
||||
from libprs500.ebooks.lrf.pylrs.pylrs import Paragraph, CR, Italic, ImageStream, \
|
||||
TextBlock, ImageBlock, JumpButton, CharButton, \
|
||||
Plot, Image, BlockSpace, RuledLine, BookSetting, Canvas, DropCaps, \
|
||||
LrsError
|
||||
LrsError, Sup, Sub
|
||||
from libprs500.ebooks.lrf.pylrs.pylrs import Span as _Span
|
||||
from libprs500.ebooks.lrf import Book
|
||||
from libprs500.ebooks.lrf import option_parser as lrf_option_parser
|
||||
@ -1182,6 +1182,11 @@ class HTMLConverter(object):
|
||||
self.current_para = Paragraph()
|
||||
self.current_block = self.book.create_text_block(textStyle=pb.textStyle,
|
||||
blockStyle=pb.blockStyle)
|
||||
elif tagname in ['sub', 'sup']:
|
||||
text = self.get_text(tag)
|
||||
elem = Sub if tagname == 'sub' else Sup
|
||||
self.current_para.append(elem(text))
|
||||
|
||||
elif tagname in ['p', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']:
|
||||
if tag.has_key('id'):
|
||||
target = self.book.create_text_block(textStyle=self.current_block.textStyle,
|
||||
|
@ -104,6 +104,7 @@
|
||||
<p>
|
||||
A simple <i>paragraph</i> of <b>formatted
|
||||
<i>text</i></b>, with a ruled line following it.
|
||||
Super<sup>scripts</sup> and Sub<sub>scripts</sub>.
|
||||
</p>
|
||||
<hr/>
|
||||
<p> A
|
||||
@ -122,7 +123,8 @@
|
||||
<hr/>
|
||||
<p style='text-indent:30em'>A very indented paragraph</p>
|
||||
<p style='text-indent:0em'>An unindented paragraph</p>
|
||||
<p>A default indented paragrpah<br /></p>
|
||||
<p>A default indented paragrpah</p>
|
||||
<hr/>
|
||||
<p class='toc'>
|
||||
<hr />
|
||||
<a href='#toc'>Table of Contents</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user