Skip to content

Commit

Permalink
Use compile_string API for any compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwpolska committed Jan 8, 2017
1 parent 2e28da4 commit 4674761
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions v7/static_comments/static_comments.py
Expand Up @@ -86,18 +86,18 @@ def _compile_content(self, compiler_name, content, filename):
if compiler_name == 'rest':
content, error_level, _ = compiler.compile_string(content)
if error_level >= 3:
_LOGGER.error("Restructured text page compiler ({0}) failed to compile comment {1}!".format(compiler_name, filename))
_LOGGER.error("reStructuredText page compiler ({0}) failed to compile comment {1}!".format(compiler_name, filename))
exit(1)
return content
elif compiler_name == 'markdown':
content, deps = compiler.compile_string(content)
return content
else:
try:
return compiler.compile_to_string(content) # This is a non-standard function! May not be available with any page compiler!
return compiler.compile_string(content)[0]
except AttributeError:
_LOGGER.error("Page compiler plugin '{0}' provides no compile_to_string function (comment {1})!".format(compiler_name, filename))
exit(1)
try:
return compiler.compile_to_string(content)
except AttributeError:
_LOGGER.error("Page compiler plugin '{0}' provides no compile_to_string function (comment {1})!".format(compiler_name, filename))
exit(1)

def _read_comment(self, filename, owner, id):
"""Read a comment from a file."""
Expand Down

0 comments on commit 4674761

Please sign in to comment.