def view(*a, **k): d = system.__dict__ lib_path = system.lib_path instance_path = system.instance_path site_path = system.config.site_path theme_path = system.themes_path app_paths = manager.app_paths status = status_info() return page(markdown(""" Paths ---- <pre> lib_path......: %(lib_path)s instance_path.: %(instance_path)s site_path.....: %(site_path)s theme_path....: %(theme_path)s app_path......: %(app_paths)s </pre> Context ---- %(status)s """) % locals(), title='Overview')
def load_document(name, args={}): filename = 'docs/{}.md'.format(name) feature, messages, body = '', '', '' if os.path.exists(filename): body = markdown(load(filename).format(**args)) if BREAKER in body: parts = body.split(BREAKER) if len(parts) == 3: feature, messages, body = parts elif len(parts) == 2: feature, body = parts return feature, messages, body
def __call__(self, vis=None): system.app.menu.append('Data Visualization') if vis: method = getattr(self, vis.replace('-','_')) result = method() result['side_panel'] = markdown(toc) result['doc'] = method.__doc__ result['code'] = get_code(method) result['data'] = '' return page(tpl, callback=result.get, css=css) else: return self.index()
def __call__(self, vis=None): system.app.menu.append('Data Visualization') if vis: method = getattr(self, vis.replace('-', '_')) result = method() result['side_panel'] = markdown(toc) result['doc'] = method.__doc__ result['code'] = get_code(method) result['data'] = '' return page(tpl, callback=result.get, css=css) else: return self.index()
def index(self): def get_title(method): code = getsource(method) title = method.__doc__.splitlines()[0] return title thumbnails = [] for name, method in getmembers(self, predicate=ismethod): if not name.startswith('_') and not name in ['index', 'show']: link = link_to(get_title(method), name) thumbnails.append(method()['visualization']) content = ul(div(t, Class='thumbnail') for t in thumbnails) return page( div( div( markdown(toc), Class="col-md-3", ) + div( content, Class="col-md-9 thumbnails", ), Class='row', ), css=css)
def index(self): def get_title(method): code = getsource(method) title = method.__doc__.splitlines()[0] return title thumbnails = [] for name, method in getmembers(self, predicate=ismethod): if not name.startswith('_') and not name in ['index', 'show']: link = link_to(get_title(method), name) thumbnails.append(method()['visualization']) content = ul(div(t, Class='thumbnail') for t in thumbnails) return page(div( div( markdown(toc), Class="col-md-3", ) + div( content, Class="col-md-9 thumbnails", ), Class='row', ), css=css)
def get_code(method): source = getsource(method) lines = [l[4:] for l in source.splitlines()[1:-1]] selection = '\n'.join(lines) return markdown(selection)