summaryrefslogtreecommitdiff
path: root/megapixels/app
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-03-08 17:19:36 +0100
committerJules Laplace <julescarbon@gmail.com>2019-03-08 17:19:36 +0100
commit1dcb61dab45b4891b1b737877d3d95e1211f33b3 (patch)
treea13ee4541e0a55dcbdfe5701b79ddd8da6ed8ca9 /megapixels/app
parent6ddf79260f153aa52d2b444772c03cae502f4d35 (diff)
sortable dataset list
Diffstat (limited to 'megapixels/app')
-rw-r--r--megapixels/app/settings/app_cfg.py2
-rw-r--r--megapixels/app/site/loader.py10
2 files changed, 10 insertions, 2 deletions
diff --git a/megapixels/app/settings/app_cfg.py b/megapixels/app/settings/app_cfg.py
index d213f584..891ab503 100644
--- a/megapixels/app/settings/app_cfg.py
+++ b/megapixels/app/settings/app_cfg.py
@@ -167,6 +167,8 @@ DIR_SITE_CONTENT = "../site/content/pages"
DIR_SITE_TEMPLATES = "../site/templates"
DIR_SITE_INCLUDES = "../site/includes"
DIR_SITE_USER_CONTENT = "../site/public/user_content"
+DIR_SITE_DATASETS = "../site/datasets/"
+DIR_SITE_FINAL_CITATIONS = "../site/datasets/final/"
# -----------------------------------------------------------------------------
# Celery
diff --git a/megapixels/app/site/loader.py b/megapixels/app/site/loader.py
index 04f7653a..80ac4710 100644
--- a/megapixels/app/site/loader.py
+++ b/megapixels/app/site/loader.py
@@ -1,10 +1,11 @@
import os
import re
import glob
-import simplejson as json
import app.settings.app_cfg as cfg
+from app.utils.file_utils import load_json
+
def read_metadata(fn):
"""
Read in read a markdown file and extract the metadata
@@ -36,7 +37,8 @@ def parse_metadata(fn, sections):
"""
parse the metadata headers in a markdown file
(everything before the second ---------)
- also generates appropriate urls for this page :)
+ - determines appropriate urls for this page
+ - loads paper if any
"""
found_meta = False
metadata = {}
@@ -78,6 +80,10 @@ def parse_metadata(fn, sections):
metadata['author_html'] = '<br>'.join(metadata['authors'].split(','))
+ dataset_path = os.path.join(cfg.DIR_SITE_FINAL_CITATIONS, metadata['slug'] + '.json')
+ if os.path.exists(dataset_path):
+ metadata['meta'] = load_json(dataset_path)
+
return metadata, valid_sections
def parse_metadata_section(metadata, section):