diff options
Diffstat (limited to 'cli/commands/site/export.py')
| -rw-r--r-- | cli/commands/site/export.py | 11 |
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 |
