commit 8c8dde2b8473ad6c434a3e57432638cc5c2a6a0a
parent 1a44c474f4274b66324a831ab892d232481c7e53
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Tue, 6 Apr 2021 00:03:32 -0500
Everything into data
Diffstat:
8 files changed, 33 insertions(+), 25 deletions(-)
diff --git a/options.json b/data/options.json
diff --git a/data/sites/sample/.hierarchy.json.swo b/data/sites/sample/.hierarchy.json.swo
Binary files differ.
diff --git a/data/sites/sample/hierarchy.json b/data/sites/sample/hierarchy.json
@@ -0,0 +1,24 @@
+{
+ "home" : {
+ "type" : "Page",
+ "file" : "index.html",
+ "title" : "Home",
+ "navid" : "@@home"
+ },
+ "about" : {
+ "type" : "Page",
+ "file" : "about.html",
+ "title" : "About",
+ "navid" : "@@about"
+ },
+ "blog" : {
+ "type" : "Category",
+ "title" : "Blog",
+ "dir" : "blogposts"
+ },
+ "remote" : {
+ "type" : "Link",
+ "title" : "Remote",
+ "href" : "https://sample.org"
+ }
+}
diff --git a/templates/sample/links.json b/data/templates/sample/links.json
diff --git a/templates/sample/page.html b/data/templates/sample/page.html
diff --git a/templates/sample/style.css b/data/templates/sample/style.css
diff --git a/sites/sample/hierarchy.json b/sites/sample/hierarchy.json
@@ -1,24 +0,0 @@
-{
- "homepage" : {
- "type" : "Page",
- "file" : "index.html",
- "title" : "Home",
- "navid" : "@@home"
- },
- "about" : {
- "type" : "Page",
- "file" : "about.html",
- "title" : "About",
- "navid" : "@@about"
- },
- "blog" : {
- "type" : "Category",
- "title" : "Blog",
- "dir" : "blogposts"
- },
- "remote" : {
- "type" : "Link",
- "title" : "Remote",
- "href" : "https://sample.org"
- }
-}
diff --git a/src/share.py b/src/share.py
@@ -4,8 +4,11 @@ import os, sys, json
# Values
DATA_DIR = "data"
-OPTIONS_FILE = "options.json"
+OPTIONS_FILE = os.path.join(DATA_DIR, "options.json")
INTERFACES_FILE = os.path.join(DATA_DIR, "interfaces.json")
+SITE_DIR = ""
+HIERARCHY_FILE = ""
+LOADED_HIERARCHY = {}
LOADED_OPTIONS = {}
LOADED_INTERFACES = {}
INTERFACE_FUNCS = {
@@ -19,3 +22,8 @@ INTERFACE_FUNCS = {
# Loading
with open(OPTIONS_FILE) as o: LOADED_OPTIONS = json.load(o)
with open(INTERFACES_FILE) as i: LOADED_INTERFACES = json.load(i)
+
+# Environment
+SITE_DIR = os.path.join(DATA_DIR, "sites", LOADED_OPTIONS["active_site"], "site")
+HIERARCHY_FILE = os.path.join(DATA_DIR, "sites", LOADED_OPTIONS["active_site"], "hierarchy.json")
+with open(HIERARCHY_FILE) as h: LOADED_HIERARCHY = json.load(h)