Skip to content

Commit

Permalink
Mentioning MarkDown plugin (getnikola/nikola#2622). Removed compile_s…
Browse files Browse the repository at this point in the history
…tring function support.
  • Loading branch information
felixfontein committed Jan 8, 2017
1 parent c58e2a2 commit 339ae5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion v7/static_comments/README.md
Expand Up @@ -31,7 +31,7 @@ Comment files are of the following form::

the content spans the rest of the file.

Most header fields are optional. `compiler` must specify a page compiler which allows to compile a content given as a string to a string; these are currently the restructured text compiler (`rest`), the `ipynb` compiler, and the [WordPress](https://plugins.getnikola.com/#wordpress_compiler) (`wordpress`) compiler. You can also specify `html`, in which case the comment's content will be taken as HTML without any processing.
Most header fields are optional. `compiler` must specify a page compiler which allows to compile a content given as a string to a string; these are currently the restructured text compiler (`rest`), the MarkDown compiler (`markdown`; only allows this in Nikola git master yet, though), and the [WordPress](https://plugins.getnikola.com/#wordpress_compiler) (`wordpress`) compiler. You can also specify `html`, in which case the comment's content will be taken as HTML without any processing.

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Jan 8, 2017

Member

you can say v7.8.2 here


Comments can form a hierarchy; `parent_id` must be the comment ID of the parent comment, or left away if there's no parent.

Expand Down
9 changes: 2 additions & 7 deletions v7/static_comments/static_comments.py
Expand Up @@ -89,17 +89,12 @@ def _compile_content(self, compiler_name, content, filename):
_LOGGER.error("Restructured text page compiler ({0}) failed to compile comment {1}!".format(compiler_name, filename))
exit(1)
return content
elif compiler_name == 'ipynb':
return compiler.compile_string(content)
else:
try:
return compiler.compile_to_string(content) # This is a non-standard function! May not be available with any page compiler!
except AttributeError:
try:
return compiler.compile_string(content) # This is a non-standard function! May not be available with any page compiler!
except AttributeError:
_LOGGER.error("Page compiler plugin '{0}' provides no compile_to_string or compile_string function (comment {1})!".format(compiler_name, filename))
exit(1)
_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

2 comments on commit 339ae5e

@Kwpolska
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎, the API should be compile_string to match the official, built-in reST plugin.

@felixfontein
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It matches it as closely as it can. The second return argument makes no sense for MarkDown.

Please sign in to comment.