Exemplo n.º 1
0
def markdown_reader(path):
    meta, content = split_content(path)
    content = content.replace("\n", "  \n")
    if not meta:
        meta = ObjectDict()
    else:
        meta = parse_meta(meta, path)
    return Post(path=path, meta=meta, content=md.render(content))
Exemplo n.º 2
0
def test_meta_parser():
    meta_txt = """
    # Hello, world!

    - tags: hello, world
    """

    lines = [l.strip() for l in meta_txt.splitlines() if l]
    meta = parse_meta(lines)
    assert meta.title == "Hello, world!"
    assert meta.tags == "hello, world"
Exemplo n.º 3
0
def markdown_reader(path):
    meta, content = split_content(path)
    content = content.replace("\n", "  \n")
    if not meta:
        meta = ObjectDict()
    else:
        meta = parse_meta(meta, path)
    return Post(
        path=path,
        meta=meta,
        content=md.render(content)
    )
Exemplo n.º 4
0
def test_parse_unknown_meta():
    parse_meta(["fdsjaklfdsjaklfdsjaklfjdsklfjsa"])