1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import click
from app.settings import app_cfg
@click.command('info')
@click.option('-g', '--graph', 'opt_graph_path', required=True,
help='Graph name')
@click.option('-o', '--output', 'opt_output_dir', required=True, default=app_cfg.DIR_EXPORTS,
help='Output dir')
@click.pass_context
def cli(ctx, opt_graph_path, opt_output_dir):
"""Export a graph"""
# ------------------------------------------------
# imports
from os.path import join
from app.sql.common import db, Session, Graph, Page, Tile
# ------------------------------------------------
# generate HTML for all pages
session = Session()
graph = session.query(Graph).filter(Graph.path == opt_graph_path).first()
if graph is None:
print(f"Not a graph: {opt_graph_path}")
return
for page in graph.pages:
page_path = f'{graph.path}/{page.path}'
if page.id == graph.home_page_id:
print(f'/{page_path} [index]')
else:
print(f'/{page_path}')
#
# ------------------------------------------------
# cat all the relevant CSS from the main site
|