From 10a48a1cbd78a63ffd72e90ca4e30d528de4809c Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Sat, 9 Jan 2021 20:26:57 +0100 Subject: [PATCH] Early support for org mode. --- app/db.py | 4 +++- app/render.py | 2 ++ requirements.txt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/db.py b/app/db.py index eb9b99e..2837f4f 100644 --- a/app/db.py +++ b/app/db.py @@ -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): """ diff --git a/app/render.py b/app/render.py index 040a807..6f5d089 100644 --- a/app/render.py +++ b/app/render.py @@ -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 diff --git a/requirements.txt b/requirements.txt index 7c67f60..43e1ec8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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