mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Add MarkdownString.__html__().
This commit is contained in:
parent
b924a82236
commit
bc0b4acb84
2 changed files with 7 additions and 2 deletions
|
@ -31,11 +31,17 @@ class MarkdownString(object):
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.source_text
|
return self.source_text
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return unicode(self.source_text).encode()
|
||||||
|
|
||||||
|
def __html__(self):
|
||||||
|
return self.as_html
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def as_html(self):
|
def as_html(self):
|
||||||
"""Returns the string as HTML4."""
|
"""Returns the string as HTML4."""
|
||||||
|
|
||||||
if self._as_html:
|
if self._as_html is not None:
|
||||||
return self._as_html
|
return self._as_html
|
||||||
|
|
||||||
md = markdown.Markdown(
|
md = markdown.Markdown(
|
||||||
|
|
|
@ -145,4 +145,3 @@ except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue