Add tweet embeds.
This commit is contained in:
parent
8906ad4123
commit
cfea2bda07
|
@ -222,10 +222,10 @@ class Subnode:
|
|||
def render(self):
|
||||
# hack hack
|
||||
if self.uri.endswith('md') or self.uri.endswith('MD'):
|
||||
return render.markdown(self.content)
|
||||
content = render.markdown(self.content)
|
||||
if self.uri.endswith('org') or self.uri.endswith('ORG'):
|
||||
print("trying to render org-mode")
|
||||
return render.orgmode(self.content)
|
||||
content = render.orgmode(self.content)
|
||||
return render.postprocess(content)
|
||||
|
||||
def go(self):
|
||||
"""
|
||||
|
|
|
@ -49,5 +49,16 @@ class Wikilinks():
|
|||
markdown = Markdown(extensions=[Wikilinks])
|
||||
|
||||
|
||||
# Org-mode goes here.
|
||||
# Org-mode -- simple but, well, bad for now.
|
||||
orgmode = to_html
|
||||
|
||||
|
||||
# Twitter embeds.
|
||||
def add_twitter_embeds(content):
|
||||
TWITTER_REGEX='(https://twitter.com/\w+/status/[0-9]+)'
|
||||
TWITTER_EMBED='<blockquote class="twitter-tweet" data-dnt="true" data-theme="dark"><a href="\\1"></blockquote><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'
|
||||
return re.sub(TWITTER_REGEX, TWITTER_EMBED, content)
|
||||
|
||||
|
||||
# "Pipeline"
|
||||
postprocess = add_twitter_embeds
|
||||
|
|
Loading…
Reference in New Issue