How to use the lookatme.schemas.StyleSchema function in lookatme

To help you get started, we’ve selected a few lookatme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github d0c-s4vage / lookatme / lookatme / themes / __init__.py View on Github external
def ensure_defaults(mod):
    """Ensure that all required attributes exist within the provided module
    """
    defaults = StyleSchema().dump(StyleSchema())
    dict_deep_update(defaults, mod.theme)
    return defaults
github d0c-s4vage / lookatme / lookatme / schemas.py View on Github external
})


class MetaSchema(Schema):
    """The schema for presentation metadata
    """
    class Meta:
        render_module = YamlRender

    title = fields.Str(default="", missing="")
    date = fields.Date(
        default=datetime.datetime.now(),
        missing=datetime.datetime.now(),
    )
    author = fields.Str(default="", missing="")
    styles = fields.Nested(StyleSchema, default={}, missing={})
    extensions = fields.List(fields.Str(), default=[], missing={})
github d0c-s4vage / lookatme / lookatme / __main__.py View on Github external
def main(debug, log_path, theme, code_style, dump_styles, input_files, live_reload):
    """lookatme - An interactive, terminal-based markdown presentation tool.
    """
    if debug:
        lookatme.config.LOG = lookatme.log.create_log(log_path)
    else:
        lookatme.config.LOG = lookatme.log.create_null_log()

    if len(input_files) == 0:
        input_files = [io.StringIO("")]
    pres = Presentation(input_files[0], theme, code_style, live_reload=live_reload)

    if dump_styles:
        print(StyleSchema().dumps(pres.styles))
        return 0

    try:
        pres.run()
    except Exception as e:
        number = pres.tui.curr_slide.number + 1
        click.echo(f"Error rendering slide {number}: {e}")
        if not debug:
            click.echo("Rerun with --debug to view the full traceback in logs")
        else:
            lookatme.config.LOG.exception(f"Error rendering slide {number}: {e}")
            click.echo(f"See {log_path} for traceback")
        raise click.Abort()