summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-07-11 16:09:00 +0200
committerJules Laplace <julescarbon@gmail.com>2020-07-11 16:09:00 +0200
commit3f79077a17f5b5d84282e2c4b81f8a67a22da3a4 (patch)
treefff8b2ece8568c83125cda67188ecbc3f5c4ec26 /cli
parentcf4098b20dadcd378ef2730f32f70e327ab262b4 (diff)
handling duplicate page names
Diffstat (limited to 'cli')
-rw-r--r--cli/commands/site/export.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/cli/commands/site/export.py b/cli/commands/site/export.py
index d715c6c..55f0a31 100644
--- a/cli/commands/site/export.py
+++ b/cli/commands/site/export.py
@@ -38,7 +38,7 @@ def cli(ctx, opt_graph_path, opt_output_dir):
# write site JSON data
site_data = { 'graph': sanitize_graph(graph.toSiteJSON()) }
- write_json(site_data, join(graph_dir, 'index.json'), default=str)
+ write_json(site_data, join(graph_dir, 'index.json'), default=str, minify=False)
# import custom css
site_css = load_text(join(app_cfg.DIR_STATIC, 'site.css'), split=False)
@@ -88,9 +88,15 @@ def sanitize_graph(graph):
page_path_lookup = {}
page_lookup = {}
for page in graph['pages']:
- page_path_lookup[page['id']] = join('/', graph['path'], page['path'])
+ page_path = join('/', graph['path'], page['path'])
+ if page_path in page_path_lookup:
+ print(f"/!\\ WARNING! Duplicate found of {page_path}")
+ else:
+ page_path_lookup[page['id']] = page_path
for page in graph['pages']:
sanitize_page(page)
+ if page['id'] == 12:
+ print(page)
for tile in page['tiles']:
if tile['target_page_id']:
if tile['target_page_id'] == -1:
@@ -100,6 +106,7 @@ def sanitize_graph(graph):
sanitize_tile(tile)
page_path = page_path_lookup[page['id']]
page_lookup[page_path] = page
+ # print(page_lookup['/asdf/testttt'])
graph['pages'] = page_lookup
graph['home_page'] = page_path_lookup[graph['home_page_id']]
return graph