summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--markdown_link_style/_version.py2
-rw-r--r--mdl_style.py5
-rw-r--r--tests/data/inline_parses_images_00-expected.md5
-rw-r--r--tests/data/inline_parses_images_00.md7
-rw-r--r--tests/test_mdl_style.py6
6 files changed, 23 insertions, 3 deletions
diff --git a/TODO b/TODO
index cfbc941..931c005 100644
--- a/TODO
+++ b/TODO
@@ -38,7 +38,6 @@ TODO
* Emphasis
* Code
- * Images
For instance, if the input contains ``## This is an H2``, the
``mdl_style.LSRenderer`` renderer must not change it to ``<h2>This
diff --git a/markdown_link_style/_version.py b/markdown_link_style/_version.py
index 1489137..3c3eadb 100644
--- a/markdown_link_style/_version.py
+++ b/markdown_link_style/_version.py
@@ -18,4 +18,4 @@
# along with markdown-link-style (see COPYING). If not, see
# <http://www.gnu.org/licenses/>.
-__version__ = '0.1.0.dev3'
+__version__ = '0.1.0.dev4'
diff --git a/mdl_style.py b/mdl_style.py
index 3f9d716..8ed6e92 100644
--- a/mdl_style.py
+++ b/mdl_style.py
@@ -129,6 +129,11 @@ class LSRenderer(Renderer):
link_text = self._stylize_link(link, title, text)
return link_text
+ def image(self, src, title, text):
+ # Markup for images are same as links, except it is prefixed
+ # with a bang (!).
+ return '{}{}'.format('!', self.link(src, title, text))
+
def _stylize_link(self, link, title, text):
if self.link_style == 'inline':
return self._gen_inline_link(link, title, text)
diff --git a/tests/data/inline_parses_images_00-expected.md b/tests/data/inline_parses_images_00-expected.md
new file mode 100644
index 0000000..4b754f4
--- /dev/null
+++ b/tests/data/inline_parses_images_00-expected.md
@@ -0,0 +1,5 @@
+![IMG 00](/path/to/img-00.jpg)
+
+![IMG 01](/path/to/img-01.jpg "IMG 01 Title")
+
+![IMG 02](url/to/image-02 "IMG 02 Title")
diff --git a/tests/data/inline_parses_images_00.md b/tests/data/inline_parses_images_00.md
new file mode 100644
index 0000000..7fab86d
--- /dev/null
+++ b/tests/data/inline_parses_images_00.md
@@ -0,0 +1,7 @@
+![IMG 00](/path/to/img-00.jpg)
+
+![IMG 01](/path/to/img-01.jpg "IMG 01 Title")
+
+![IMG 02][img02-id]
+
+[img02-id]: url/to/image-02 "IMG 02 Title"
diff --git a/tests/test_mdl_style.py b/tests/test_mdl_style.py
index 21463fc..94cdd75 100644
--- a/tests/test_mdl_style.py
+++ b/tests/test_mdl_style.py
@@ -47,9 +47,13 @@ class TestLSRendererIL(object):
expected_result = _get_data('inline_link_style_00-expected.md')
assert_equal(self.md(d), expected_result)
+ def test_renderer_parses_images(self):
+ d = _get_data('inline_parses_images_00.md')
+ expected_result = _get_data('inline_parses_images_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):