markdown-link-style

switch between inline and footnote link style in markdown documents.
git clone git://git.ricketyspace.net/markdown-link-style.git
Log | Files | Refs

commit 08f44ce7e60f61a2a87a71ee033b045b8d995125
parent a8a5fcbfdbead2093ca23010ec684dc225830596
Author: rsiddharth <s@ricketyspace.net>
Date:   Tue, 21 Feb 2017 02:21:25 +0000

tests.tests.mdl_style: Add tests for `mdl_style.LSRenderer`.

* TODO: Update file.
* tests/data/does_not_parse_blockquotes_00.md: Add file.
* tests/data/does_not_parse_codeblocks_00.md: Add file.
* tests/data/does_not_parse_headers_00.md: Add file.
* tests/data/does_not_parse_hrules_00.md: Add file.
* tests/data/does_not_parse_link_breaks_00.md: Add file.
* tests/data/does_not_parse_lists_00.md: Add file.
* tests/test_mdl_style.py
(TestLSRendererIL.test_renderer_does_not_parse_link_breaks): Add test method.
(TestLSRendererIL.test_renderer_does_not_parse_headers): Add test method.
(TestLSRendererIL.test_renderer_does_not_parse_blockquotes): Add test method.
(TestLSRendererIL.test_renderer_does_not_parse_lists): Add test method.
(TestLSRendererIL.test_renderer_does_not_parse_codeblocks): Add test method.
(TestLSRendererIL.test_renderer_does_not_parse_hrules): Add test method.

Diffstat:
TODO | 9---------
tests/data/does_not_parse_blockquotes_00.md | 37+++++++++++++++++++++++++++++++++++++
tests/data/does_not_parse_codeblocks_00.md | 9+++++++++
tests/data/does_not_parse_headers_00.md | 37+++++++++++++++++++++++++++++++++++++
tests/data/does_not_parse_hrules_00.md | 30++++++++++++++++++++++++++++++
tests/data/does_not_parse_link_breaks_00.md | 40++++++++++++++++++++++++++++++++++++++++
tests/data/does_not_parse_lists_00.md | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/test_mdl_style.py | 26+++++++++++++++++++++++++-
8 files changed, 249 insertions(+), 10 deletions(-)

diff --git a/TODO b/TODO @@ -34,15 +34,6 @@ TODO block/inline elements are not modified by the ``mdl_style.LSRenderer`` renderer: - * Block elements: - - * Paragraphs and Line Breaks - * Headers - * Blockquotes - * Lists - * Code Blocks - * Horizontal Rules - * Inline elements: * Emphasis diff --git a/tests/data/does_not_parse_blockquotes_00.md b/tests/data/does_not_parse_blockquotes_00.md @@ -0,0 +1,37 @@ +Canonical blockquotes + +> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, +> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. +> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. +> +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse +> id sem consectetuer libero luctus adipiscing. + +Lazy blockquotes + +> This is a blockquote with two paragraphs. Lorem ipsum dolor sit +amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere +lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet +vitae, risus. + +> Donec sit amet nisl. Aliquam semper ipsum sit amet +velit. Suspendisse id sem consectetuer libero luctus adipiscing. + +Nested blockquotes + +> This is the first level of quoting. +> +> > This is nested blockquote. +> +> Back to the first level. + +Markdown elements inside blockquotes. + +> ## This is a header. +> +> 1. This is the first list item. +> 2. This is the second list item. +> +> Here's some example code: +> +> return shell_exec("echo $input | $markdown_script"); diff --git a/tests/data/does_not_parse_codeblocks_00.md b/tests/data/does_not_parse_codeblocks_00.md @@ -0,0 +1,9 @@ +This is a normal paragraph: + + This is a code block. + +Here is an example of AppleScript: + + tell application "Foo" + beep + end tell diff --git a/tests/data/does_not_parse_headers_00.md b/tests/data/does_not_parse_headers_00.md @@ -0,0 +1,37 @@ +# Sed sagittis Ante + +Sed semper congue, erat libero condimentum nulla, et accumsan ligula +ante consectetur justo. Aliquam molestie at ex at ornare. Sed lectus +tellus, porttitor vel imperdiet nec, eleifend porta erat. Quisque +tortor mi, sagittis quis finibus vel, porta nec velit. Donec luctus +tristique hendrerit. Sed dictum urna convallis quam interdum, non +vulputate nibh consectetur. + +## Mauris consequat sem + +Sit amet dui suscipit, et ullamcorper quam rutrum. Donec ultrices nibh +erat, sit amet maximus ipsum mattis a. Mauris porta nec massa id +aliquet. Suspendisse potenti. Maecenas tempor lacus at orci luctus +porttitor. Ut vestibulum nisl sit amet turpis aliquet blandit a sit +amet massa. Aenean id justo pharetra, laoreet mi at, rhoncus +nunc. Etiam gravida mi et massa maximus bibendum. Vivamus molestie +porttitor lobortis. In efficitur et nisi vitae ultrices. + +### Cras arcu mi dictum + +Cras arcu mi, dictum in est sed, accumsan tempor ex. Pellentesque quis +venenatis est. Morbi porttitor lorem sed lacus mollis efficitur. Fusce +sollicitudin augue quis lorem bibendum, id malesuada quam dapibus. Sed +viverra nulla non pulvinar porta. Donec a ex nec lacus pellentesque +faucibus. In et urna efficitur, placerat felis sit amet, tristique +mi. In hac habitasse platea dictumst. Sed sit amet leo sed nulla +lobortis efficitur. + +#### Fusce blandit fermentum + +Nulla sagittis bibendum. Integer in massa non lacus eleifend +dignissim. Integer aliquam vehicula orci, sed auctor nulla lacinia +eu. Aliquam luctus ante sit amet hendrerit iaculis. Nullam fringilla, +magna sit amet volutpat mollis, enim eros egestas quam, vel blandit +quam massa eget justo. Praesent lobortis vulputate elit, a facilisis +odio condimentum consectetur. Nam eu laoreet tortor, id rhoncus velit. diff --git a/tests/data/does_not_parse_hrules_00.md b/tests/data/does_not_parse_hrules_00.md @@ -0,0 +1,30 @@ +Suspendisse sagittis lectus a elit elementum consectetur at nec +purus. Proin ullamcorper risus quam. Nam malesuada augue ipsum, sit +amet ultricies nunc elementum a. Curabitur lacinia nisl viverra, +mollis nisl id, luctus diam. + +* * * + +In porta erat id malesuada mattis. Nullam viverra diam ut consectetur +aliquam. Curabitur consequat nibh eget lobortis congue. Vestibulum sem +orci, dignissim sit amet porta a, consectetur vel enim. + +*** + +Etiam laoreet pharetra ipsum, sed lobortis urna maximus a. Quisque +congue dolor nunc, mattis porttitor erat vestibulum ut. + +***** + +Sed tristique, neque sed malesuada gravida, lectus ante sagittis +lorem, eu pretium lacus nulla vel lectus. Nam maximus commodo velit id +porttitor. Vivamus imperdiet augue a interdum gravida. Aliquam +porttitor turpis hendrerit sodales tincidunt. + +- - - + +Nam maximus commodo velit id porttitor. Vivamus imperdiet augue a +interdum gravida. Aliquam porttitor turpis hendrerit sodales +tincidunt. + +--------------------------------------- diff --git a/tests/data/does_not_parse_link_breaks_00.md b/tests/data/does_not_parse_link_breaks_00.md @@ -0,0 +1,40 @@ +Maecenas maximus nec mauris id posuere. Nullam eu ante iaculis, semper +est a, aliquet purus. Cras tempus pulvinar nisi. Vestibulum non nulla +non lectus tempus semper. Integer felis est, consequat id ex vitae, +congue faucibus arcu. Pellentesque consequat velit mauris, sit amet +cursus turpis ultricies blandit. In ornare est purus, eu bibendum erat +interdum ac. Sed ac elit non eros iaculis euismod sit amet eu +sapien. Phasellus hendrerit facilisis faucibus. Vivamus dapibus, magna +quis elementum pellentesque, magna nulla venenatis nisi, nec +consectetur est felis gravida purus. Ut et sollicitudin elit, vitae +consequat nulla. Etiam interdum tempor ipsum a faucibus. Vivamus +ultrices velit id neque eleifend, sit amet vulputate ex +ultricies. Aliquam convallis, eros a scelerisque pulvinar, ex leo +sagittis nulla, a sodales justo dui id velit. Etiam vitae egestas +ante. Curabitur venenatis vulputate elit, in luctus dolor. + +Morbi et tellus sem. Nulla semper lacus tellus, a fringilla turpis +commodo at. Cras accumsan est nec massa fermentum molestie. Sed at +libero elit. Etiam tellus augue, egestas in mattis non, pulvinar sed +neque. Nulla ut lacinia augue. Aenean at mi lacinia, ullamcorper augue +ut, fringilla felis. Nullam eget luctus sem, sit amet lacinia +tellus. Aliquam diam dolor, fringilla et erat quis, feugiat molestie +ipsum. Ut ultricies pellentesque lectus vitae faucibus. Curabitur +aliquet lectus id mauris efficitur, quis pharetra lacus +volutpat. Quisque aliquet in nisi ut fermentum. Donec sodales faucibus +augue, a rhoncus massa consequat vitae. + +Maecenas pellentesque arcu ex, non consectetur dolor fermentum +iaculis. Pellentesque in risus id quam semper sodales. Donec mattis +molestie neque, quis imperdiet mauris volutpat a. Aliquam in dolor +tellus. In purus erat, euismod ac ultricies sit amet, laoreet eget +libero. Sed molestie porttitor suscipit. Fusce eget massa +arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices +posuere cubilia Curae; Etiam rhoncus, quam vitae tempus suscipit, diam +ex aliquam libero, in volutpat mauris ex ac orci. Duis ac leo +lectus. Vestibulum faucibus dui et diam lacinia, aliquam tempus ligula +eleifend. Etiam ullamcorper suscipit elit eu ullamcorper. Phasellus +dolor risus, rutrum in metus nec, vehicula sollicitudin libero. Proin +dignissim sapien ut odio pharetra, at interdum sem auctor. Ut lobortis +quis nulla a feugiat. Maecenas pharetra, elit nec blandit pulvinar, +eros purus blandit magna, non scelerisque lectus metus nec arcu. diff --git a/tests/data/does_not_parse_lists_00.md b/tests/data/does_not_parse_lists_00.md @@ -0,0 +1,71 @@ +* Red +* Green +* Blue + ++ Red ++ Green ++ Blue + +- Red +- Green +- Blue + +1. Bird +2. McHale +3. Parish + +1. Bird +1. McHale +1. Parish + +3. Bird +1. McHale +8. Parish + +* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. +* Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. +Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, +viverra nec, fringilla in, laoreet vitae, risus. +* Donec sit amet nisl. Aliquam semper ipsum sit amet velit. +Suspendisse id sem consectetuer libero luctus adipiscing. + +* Bird +* Magic + +* Bird + +* Magic + +1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + +2. Suspendisse id sem consectetuer libero luctus adipiscing. + +* This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're +only required to indent the first line. Lorem ipsum dolor +sit amet, consectetuer adipiscing elit. + +* Another item in the same list. + +* A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +* A list item with a code block: + + <code goes here> + +1986\. What a great season. diff --git a/tests/test_mdl_style.py b/tests/test_mdl_style.py @@ -42,12 +42,36 @@ class TestLSRendererIL(object): d_expected = _get_data('autolink_00-expected.md') assert_equals(self.md(d), d_expected) - def test_link_footnote_to_inline_style_conversion_00(self): d = _get_data('inline_link_style_00.md') expected_result = _get_data('inline_link_style_00-expected.md') assert_equal(self.md(d), expected_result) + def test_renderer_does_not_parse_link_breaks(self): + d = _get_data('does_not_parse_link_breaks_00.md') + #print('${}$'.format(self.md(d))) + assert_equal(self.md(d), d) + + def test_renderer_does_not_parse_headers(self): + d = _get_data('does_not_parse_headers_00.md') + assert_equal(self.md(d), d) + + def test_renderer_does_not_parse_blockquotes(self): + d = _get_data('does_not_parse_blockquotes_00.md') + assert_equal(self.md(d), d) + + def test_renderer_does_not_parse_lists(self): + d = _get_data('does_not_parse_lists_00.md') + assert_equal(self.md(d), d) + + def test_renderer_does_not_parse_codeblocks(self): + d = _get_data('does_not_parse_codeblocks_00.md') + assert_equal(self.md(d), d) + + def test_renderer_does_not_parse_hrules(self): + d = _get_data('does_not_parse_hrules_00.md') + assert_equal(self.md(d), d) + def teardown(self): pass