Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xhtml inline png image support #35

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Use sub/ super xhtml tags for super/subscript text
  • Loading branch information
Kris Powell committed Dec 4, 2015
commit 5db24d515c8633be2e47880d92fdaf773247cbe4
12 changes: 3 additions & 9 deletions pyth/plugins/xhtml/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
'bold': 'strong',
'italic': 'em',
'underline': 'u', # ?
'super': 'sup',
'sub': 'sub',
}


Expand Down Expand Up @@ -112,20 +114,12 @@ def _text(self, text):

current = tag

for prop in ('bold', 'italic', 'underline'):
for prop in ('bold', 'italic', 'underline', 'sub', 'super'):
if prop in text.properties:
newTag = Tag(_tagNames[prop])
current.content.append(newTag)
current = newTag

for prop in ('sub', 'super'):
if prop in text.properties:
if current.tag is None:
newTag = Tag("span")
current.content.append(newTag)
current = newTag
current.attrs['style'] = "vertical-align: %s; font-size: smaller" % prop

current.content.append(u"".join(text.content))

return tag
Expand Down