Early support for org mode.

This commit is contained in:
Flancian 2021-01-09 20:26:57 +01:00
parent 63fd389fb3
commit 10a48a1cbd
3 changed files with 6 additions and 1 deletions

View File

@ -89,6 +89,7 @@ class Graph:
@cachetools.func.ttl_cache(maxsize=1, ttl=20)
def subnodes(self, sort=lambda x: x.uri.lower()):
subnodes = [Subnode(f) for f in glob.glob(os.path.join(config.AGORA_PATH, '**/*.md'), recursive=True)]
subnodes.extend([Subnode(f) for f in glob.glob(os.path.join(config.AGORA_PATH, '**/*.org'), recursive=True)])
if sort:
return sorted(subnodes, key=sort)
else:
@ -223,7 +224,8 @@ class Subnode:
if self.uri.endswith('md') or self.uri.endswith('MD'):
return render.markdown(self.content)
if self.uri.endswith('org') or self.uri.endswith('ORG'):
return render.markdown(self.content)
print("trying to render org-mode")
return render.orgmode(self.content)
def go(self):
"""

View File

@ -22,6 +22,7 @@ import re
from . import config
from . import util
from marko import Markdown, inline
from orgpython import to_html
# Markdown
@ -49,3 +50,4 @@ markdown = Markdown(extensions=[Wikilinks])
# Org-mode goes here.
orgmode = to_html

View File

@ -14,6 +14,7 @@ Markdown==3.3.3
marko==0.9.1
MarkupSafe==1.1.1
mdx-truly-sane-lists==1.2
org-python==0.3.2
packaging==20.4
parso==0.7.1
pkg-resources==0.0.0