def test_multi_tab_case(self): plugin = CodeIncludePlugin() plugin.load_config({"title_mode": "legacy_pymdownx.superfences"}) result = plugin.on_page_markdown(MULTI_TAB_MARKDOWN_EXAMPLE, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(""" # hello world some text before ```java tab=\"foo\" public class Foo { } ``` ```java tab=\"bar\" public class Bar { // This UTF-8 encoded file has some multi-byte characters: œ, ë } ``` and some text after """).strip(), result.strip(), )
def test_ellipsis_indent(self): plugin = CodeIncludePlugin() plugin.load_config({"title_mode": "legacy_pymdownx.superfences"}) result = plugin.on_page_markdown(MARKDOWN_EXAMPLE_MULTIMATCH, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(r""" # hello world ```java tab="MultiMatch" A a ⋯ C c ``` """).strip(), result.strip(), )
def test_modern_tab_case(self): plugin = CodeIncludePlugin() plugin.load_config({}) result = plugin.on_page_markdown(MULTI_TAB_MARKDOWN_EXAMPLE, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(""" # hello world some text before === "foo" ```java public class Foo { } ``` === "bar" ```java public class Bar { // This UTF-8 encoded file has some multi-byte characters: œ, ë } ``` and some text after """).strip(), result.strip(), )
def test_no_includes(self): plugin = CodeIncludePlugin() plugin.load_config({"title_mode": "legacy_pymdownx.superfences"}) result = plugin.on_page_markdown(MARKDOWN_EXAMPLE_NO_INCLUDES, PAGE_EXAMPLE, dict()) self.assertEqual(MARKDOWN_EXAMPLE_NO_INCLUDES.strip(), result.strip())
def test_multi_tab_case(self): plugin = CodeIncludePlugin() result = plugin.on_page_markdown(MULTI_TAB_MARKDOWN_EXAMPLE, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(""" # hello world some text before ```java tab=\"foo\" public class Foo { } ``` ```java tab=\"bar\" public class Bar { } ``` and some text after """).strip(), result.strip())
def test_simple_case_right_curly_inside_block(self): plugin = CodeIncludePlugin() plugin.load_config({"title_mode": "legacy_pymdownx.superfences"}) result = plugin.on_page_markdown(MARKDOWN_EXAMPLE_RIGHT_CURLY, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(r""" # hello world ```java tab="Curly" public class Curly { public static String RIGHT_CURLY_REGEX = "\\}"; } ``` """).strip(), result.strip(), )
def test_other_language(self): plugin = CodeIncludePlugin() plugin.load_config({"title_mode": "legacy_pymdownx.superfences"}) result = plugin.on_page_markdown(MARKDOWN_EXAMPLE_OTHER_LANGUAGE, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(""" # hello world some text before ```javascript tab="other_lang" // script in a custom language ``` and some text after """).strip(), result.strip(), )
def test_simple_case_selector_on_next_line(self): plugin = CodeIncludePlugin() plugin.load_config({"title_mode": "legacy_pymdownx.superfences"}) result = plugin.on_page_markdown( MARKDOWN_EXAMPLE_SELECTOR_ON_NEXT_LINE, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(""" # hello world some text before ```java tab=\"foo\" public class Foo { ``` and some text after """).strip(), result.strip(), )
def test_empty_title_case(self): plugin = CodeIncludePlugin() plugin.load_config({"title_mode": "legacy_pymdownx.superfences"}) result = plugin.on_page_markdown(EMPTY_TITLE_MARKDOWN_EXAMPLE, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(""" # hello world some text before ```java public class Foo { } ``` and some text after """).strip(), result.strip(), )
def test_multi_blocks_case(self): plugin = CodeIncludePlugin() result = plugin.on_page_markdown(BLOCKS_MARKDOWN_EXAMPLE, PAGE_EXAMPLE, dict()) print(result) self.assertEqual( textwrap.dedent(""" # hello world some text before ```java tab=\"blocks\" public void blockA() { print("A") ⋯ print("B") } ``` and some text after """).strip(), result.strip())