Exemple #1
0
async def get_module_readme(request):
    module_name = request.match_info['module']
    version = request.match_info['version']
    if version == 'latest':
        version = None
    readme_md = au.get_readme(module_name, version=version)
    return web.Response(body=readme_md)
async def get_module_readme(request):
    module_name = request.match_info['module']
    version = request.match_info['version']
    if version == 'latest':
        version = None
    readme_md = au.get_readme(module_name, version=version)
    if readme_md is None:
        content = ''
    else:
        content = markdown.markdown(readme_md, extensions=['tables'])
        global system_conf
        global pathbuilder
        if module_name in au.mic.remote:
            imgsrceditor = ImageSrcEditor(
                pathbuilder.module_version_dir(
                    module_name, au.mic.remote[module_name]['latest_version']))
            imgsrceditor.feed(content)
            content = imgsrceditor.get_parsed()
            linkouteditor = LinkOutEditor(
                pathbuilder.module_version_dir(
                    module_name, au.mic.remote[module_name]['latest_version']))
            linkouteditor.feed(content)
            content = linkouteditor.get_parsed()
    headers = {'Content-Type': 'text/html'}
    return web.Response(body=content, headers=headers)
Exemple #3
0
def get_module_readme(request):
    module_name = request.match_info['module']
    version = request.match_info['version']
    if version == 'latest': version = None
    readme_md = au.get_readme(module_name, version=version)
    if readme_md is None:
        response = web.Response()
        response.status = 404
    else:
        readme_html = markdown.markdown(readme_md)
        response = web.Response(body=readme_html, content_type='text/html')
    return response
Exemple #4
0
def get_module_readme (request):
    queries = request.rel_url.query
    module_name = queries['module']
    version = queries['version']
    if version == 'latest': 
        version=None
    readme_md = au.get_readme(module_name, version=version)
    if readme_md is None:
        content = ''
    else:
        content = markdown.markdown(readme_md)
    return web.Response(content)