Skip to content

Commit

Permalink
Revert "Attempt to fix issue mythmon#144.
Browse files Browse the repository at this point in the history
This was a known-bad commit just to illustrate a problem.  A bad way
to fix issue mythmon#144 (add source_path param to all render() methods in
wok/renderers.py).  Removing to clean up.

This reverts commit 7cf34e2.
  • Loading branch information
matt-garman committed Dec 16, 2015
1 parent 50d0430 commit 203d416
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 30 deletions.
17 changes: 0 additions & 17 deletions test_site/content/tests/rest_error.rst

This file was deleted.

9 changes: 3 additions & 6 deletions wok/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,8 @@ def from_file(cls, path, options, engine, renderer=renderers.Plain):
page.build_meta()

page.engine.run_hook('page.render.pre', page)
print "DEBUG: page.path=\"" + str(page.path) + "\""
print "DEBUG: page.renderer=\"" + str(page.renderer) + "\""
print "DEBUG: page.renderer.render=\"" + str(page.renderer.render) + "\""
page.meta['content'] = page.renderer.render(page.original, source_path=page.path)
page.meta['preview'] = page.renderer.render(page.original_preview, source_path=page.path)
page.meta['content'] = page.renderer.render(page.original)
page.meta['preview'] = page.renderer.render(page.original_preview)
page.engine.run_hook('page.render.post', page)

return page
Expand Down Expand Up @@ -345,7 +342,7 @@ def build_meta(self):

self.engine.run_hook('page.meta.post', self)

def render(self, templ_vars=None, source_path=None):
def render(self, templ_vars=None):
"""
Renders the page with the template engine.
"""
Expand Down
14 changes: 7 additions & 7 deletions wok/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Renderer(object):
extensions = []

@classmethod
def render(cls, plain, source_path=None):
def render(cls, plain):
return plain
all.append(Renderer)

Expand All @@ -25,7 +25,7 @@ class Plain(Renderer):
extensions = ['txt']

@classmethod
def render(cls, plain, source_path=None):
def render(cls, plain):
return plain.replace('\n', '<br>')
all.append(Plain)

Expand All @@ -42,7 +42,7 @@ class Markdown(Renderer):
plugins.extend(['codehilite(css_class=codehilite)', 'fenced_code'])

@classmethod
def render(cls, plain, source_path=None):
def render(cls, plain):
return markdown(plain, cls.plugins)

all.append(Markdown)
Expand All @@ -64,7 +64,7 @@ class Markdown2(Renderer):
extras.append('fenced-code-blocks')

@classmethod
def render(cls, plain, source_path=None):
def render(cls, plain):
return markdown2.markdown(plain, extras=cls.extras)

all.append(Markdown2)
Expand All @@ -87,9 +87,9 @@ class ReStructuredText(Renderer):
extensions = ['rst']

@classmethod
def render(cls, plain, source_path=None):
def render(cls, plain):
w = rst_html_writer()
return docutils.core.publish_parts(plain, source_path=source_path, writer=w)['body']
return docutils.core.publish_parts(plain, writer=w)['body']

all.append(ReStructuredText)
except ImportError:
Expand All @@ -104,7 +104,7 @@ class Textile(Renderer):
extensions = ['textile']

@classmethod
def render(cls, plain, source_path=None):
def render(cls, plain):
return textile.textile(plain)

all.append(Textile)
Expand Down

0 comments on commit 203d416

Please sign in to comment.