コード例 #1
0
ファイル: query.py プロジェクト: anler/mdblog
def entry_string_to_dict(entry_string):
    "Returns a dictionary with the attributes of an entry parsed from a string"
    headers, body = parse_entry(entry_string)
    entry_dict = {
        "body": render_entry(body)
    }
    entry_dict.update(headers)

    return entry_dict
コード例 #2
0
ファイル: test_template.py プロジェクト: anler/mdblog
    def test_parse(self):
        "Test that parses the entry text correctly"
        entry = "title: Entry title  \ndate: 2012-02-12  \n"\
                "\n\n# This is the entry"
        headers, body = parse_entry(entry)

        self.assertEqual("Entry title", headers["title"])
        self.assertEqual("2012-02-12", headers["date"])
        self.assertEqual("# This is the entry", body)