def test_md(): title = 'This is a title' test_data = """ title: Page title created: 2010/08/13 tasg: #hello # {title} """.format(title=title) assert helpers.get_h1(test_data) == title
def _parse(self): """Extract page header data and content from a list of lines and return the result as key-value couples.""" meta, desc, content = ParseableSource._split(self.text()) meta.update( { "source": self._path, "title": meta.get("title", helpers.get_h1(content)), "template": meta.get("template", self.default_template()), "author": meta.get("author", conf.get("author")), "author_twitter": meta.get("author_twitter", conf.get("author_twitter")), "author_url": meta.get("author_url", conf.get("author_url")), "tags": list(ParseableSource._tags(meta.get("tags", ""))), "source_url": self.source_url(), "created": helpers.parse_time(meta.get("created"), self._ctime), "updated": helpers.parse_time(meta.get("updated"), self._utime), "description": meta.get("description", desc), "content": md(content.strip()), } ) return meta