From 8b56f5c3753f958291b6fdd052f53b005fe6009b Mon Sep 17 00:00:00 2001 From: Lakshmi Vyasarajan Date: Wed, 26 Jan 2011 10:17:25 +0530 Subject: [PATCH] Fixed issues with textlinks plugin --- hyde/ext/plugins/textlinks.py | 2 +- hyde/tests/ext/test_textlinks.py | 9 ++++++--- hyde/tests/test_generate.py | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hyde/ext/plugins/textlinks.py b/hyde/ext/plugins/textlinks.py index 023788f..bbe5bce 100644 --- a/hyde/ext/plugins/textlinks.py +++ b/hyde/ext/plugins/textlinks.py @@ -29,7 +29,7 @@ class TextlinksPlugin(Plugin): with {{ media_url('/abc/def') }} or equivalent. """ - content_link = re.compile('\[\[([^\]]*)\]\]', re.UNICODE|re.MULTILINE) + content_link = re.compile('\[\[([^\]^!][^\]]*)\]\]', re.UNICODE|re.MULTILINE) media_link = re.compile('\[\[\!\!([^\]]*)\]\]', re.UNICODE|re.MULTILINE) def replace_content(match): return self.template.get_content_url_statement(match.groups(1)[0]) diff --git a/hyde/tests/ext/test_textlinks.py b/hyde/tests/ext/test_textlinks.py index f9bf27a..c6c5806 100644 --- a/hyde/tests/ext/test_textlinks.py +++ b/hyde/tests/ext/test_textlinks.py @@ -33,18 +33,20 @@ class TestTextlinks(object): } text = u""" {%% markdown %%} +[[!! img/hyde-logo.png ]] * [Rich object model][hyde objects] and - [overridable hierarchical metadata]([[%(plugins)s]]) thats available for use in + [overridable hierarchical metadata]([[ %(plugins)s ]]) thats available for use in templates. * Configurable [sorting][], filtering and grouping support. -[hyde objects]: [[%(objects)s]] +[hyde objects]: [[ %(objects)s ]] [sorting]: [[%(sorter)s]] {%% endmarkdown %%} """ site = Site(TEST_SITE) site.config.plugins = ['hyde.ext.plugins.textlinks.TextlinksPlugin'] site.config.base_url = 'http://example.com/' + site.config.media_url = '/media' tlink = File(site.content.source_folder.child('tlink.html')) tlink.write(text % d) gen = Generator(site) @@ -54,4 +56,5 @@ class TestTextlinks(object): html = f.read_all() assert html for name, path in d.items(): - assert site.config.base_url + path in html \ No newline at end of file + assert site.config.base_url + path in html + assert '/media/img/hyde-logo.png' in html \ No newline at end of file diff --git a/hyde/tests/test_generate.py b/hyde/tests/test_generate.py index c1b23c7..a514895 100644 --- a/hyde/tests/test_generate.py +++ b/hyde/tests/test_generate.py @@ -157,7 +157,6 @@ main: gen.generate_all() target = File(site.config.deploy_root_path.child(resource.name)) out = target.read_all() - print out assert "abc = def" in out assert "home" in out assert "articles" in out