Esempio n. 1
0
def story(content_uri):
    """Return the text referenced by content_uri. If uri can not be
    resolved it is returned as is. Current allowed scheme is 'git'. The
    netloc 'yaj-dir' resolves to the local source tree.

    The buffer get processed by mako and rendered as markdown.
    """
    fullpath = uri.resolve_to_path(content_uri)
    buf0 = fetch.read(fullpath)
    # markdown
    rndr = HtmlRenderer()
    md = Markdown(rndr)
    return md(buf0)
Esempio n. 2
0
import os
import sys
import yaj.kjson as kjson

YAJ_DIR = os.path.dirname(os.path.realpath(__file__))
YAJ_CSS_DIR = YAJ_DIR + "/static/yaj/css"
YAJ_GIT = os.path.dirname(YAJ_DIR)

print(YAJ_GIT)

import yaj.uri as uri

if len(sys.argv) == 2:
    configfn = sys.argv[1]
    CONFIG = kjson.loadf(configfn)
    YAJ_WEB_ASSETS_DIR = uri.resolve_to_path(CONFIG.web_assets_dir)

env_web_assets_dir = os.environ.get('WEB_ASSETS_DIR')
if env_web_assets_dir:
    YAJ_WEB_ASSETS_DIR = env_web_assets_dir

if YAJ_WEB_ASSETS_DIR == None or not os.path.isdir(YAJ_WEB_ASSETS_DIR):
    raise Exception("No path found for " + YAJ_WEB_ASSETS_DIR +
                    " (set WEB_ASSETS_DIR)")

if not os.path.isdir(YAJ_CSS_DIR):
    raise "No path found for YAJ_CSS_DIR" + YAJ_CSS_DIR

# ---- Github Configuration ----
env_github_client_id = os.environ.get("GITHUB_CLIENT_ID")
if env_github_client_id:
Esempio n. 3
0
def story_metadata(id):
    return kjson.loadf(uri.resolve_to_path("git://{{GIT-SOURCE}}/doc/"+id+".jsonld"))