本文整理汇总了Python中mkdocs.build.post_process_html函数的典型用法代码示例。如果您正苦于以下问题:Python post_process_html函数的具体用法?Python post_process_html怎么用?Python post_process_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了post_process_html函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_not_use_directory_urls
def test_not_use_directory_urls(self):
md_text = 'An [internal link](internal.md) to another document.'
expected = '<p>An <a href="internal/index.html">internal link</a> to another document.</p>'
pages = [
('internal.md',)
]
site_navigation = nav.SiteNavigation(pages, use_directory_urls=False)
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html, site_navigation)
self.assertEqual(html.strip(), expected.strip())
示例2: test_anchor_only_link
def test_anchor_only_link(self):
pages = [
('index.md',),
('internal.md',),
('sub/internal.md')
]
site_navigation = nav.SiteNavigation(pages)
for page in site_navigation.walk_pages():
html = '<p><a href="#test"> </a></p>'
result = build.post_process_html(html, site_navigation)
self.assertEqual(result, html)
示例3: test_convert_internal_media
def test_convert_internal_media(self):
pages = [
('index.md',),
('internal.md',),
('sub/internal.md')
]
site_navigation = nav.SiteNavigation(pages)
expected_results = (
'<p><img alt="The initial MkDocs layout" src="./img/initial-layout.png" /></p>',
'<p><img alt="The initial MkDocs layout" src="../img/initial-layout.png" /></p>',
'<p><img alt="The initial MkDocs layout" src="../../img/initial-layout.png" /></p>',
)
for (page, expected) in zip(site_navigation.walk_pages(), expected_results):
html = '<p><img alt="The initial MkDocs layout" src="img/initial-layout.png" /></p>'
html = build.post_process_html(html, site_navigation)
self.assertEqual(html, expected)
示例4: test_ignore_external_link
def test_ignore_external_link(self):
md_text = 'An [external link](http://example.com/external.md).'
expected = '<p>An <a href="http://example.com/external.md">external link</a>.</p>'
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html)
self.assertEqual(html.strip(), expected.strip())
示例5: test_convert_internal_link_with_anchor
def test_convert_internal_link_with_anchor(self):
md_text = 'An [internal link](internal.md#section1.1) to another document.'
expected = '<p>An <a href="internal/#section1.1">internal link</a> to another document.</p>'
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html)
self.assertEqual(html.strip(), expected.strip())
示例6: test_convert_internal_link_differing_directory
def test_convert_internal_link_differing_directory(self):
md_text = 'An [internal link](../internal.md) to another document.'
expected = '<p>An <a href="../internal/">internal link</a> to another document.</p>'
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html)
self.assertEqual(html.strip(), expected.strip())
示例7: test_convert_multiple_internal_links
def test_convert_multiple_internal_links(self):
md_text = '[First link](first.md) [second link](second.md).'
expected = '<p><a href="first/">First link</a> <a href="second/">second link</a>.</p>'
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html)
self.assertEqual(html.strip(), expected.strip())