Help for web.app.render_template

Project

web.app

Function

render_template

Sample CLI

gway web.app render-template

References

['version']

Full Code

def render_template(*, title="GWAY", navbar="", content="", static="static", css_files=None):
    global _version
    version = _version = _version or gw.version()
    css_files = css_files or ["default.css"]
    css_links = "\n".join(
        f'<link rel="stylesheet" href="/{static}/styles/{css}">' for css in css_files
    )
    favicon = f'<link rel="icon" href="/{static}/favicon.ico" type="image/x-icon" />'
    credits = f'''
        <p>GWAY is powered by <a href="https://www.python.org/">Python 3.13</a>.
        Hosting by <a href="https://www.gelectriic.com/">Gelectriic Solutions</a> 
        and <a href="https://github.com/arthexis/gway">Github</a>.</p>
    '''
    return template("""<!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8" />
            <title>{{!title}}</title>
            {{!css_links}}
            {{!favicon}}
            <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        </head>
        <body>
            {{!navbar}}
            <main>{{!content}}</main>
            <br/><footer><p>This website was built, tested and released with 
                    <a href="/gway/readme">GWAY</a> 
                    <a href="https://pypi.org/project/gway/{{!version}}/">v{{!version}}</a>.</p>
            {{!credits}}
            </footer>
        </body>
        </html>
    """, **locals())