Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding support for new compile_string interface (see getnikola/nikola…
  • Loading branch information
felixfontein committed Jan 8, 2017
1 parent 0e979a4 commit d3b6c0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion v7/wordpress_compiler/wordpress/license.txt
Expand Up @@ -400,4 +400,4 @@ The source code for any program binaries or compressed scripts that are
included with the WordPress compiler plugin for Nikola can be freely
obtained at the following URL:

https://github.com/felixfontein/nikola-wordpress/
https://github.com/getnikola/plugins/tree/master/v7/wordpress_compiler
7 changes: 7 additions & 0 deletions v7/wordpress_compiler/wordpress/wordpress.py
Expand Up @@ -190,7 +190,14 @@ def __formatData(self, data, context, source=None):
_LOGGER.warning("The post '" + source + "' still contains shortcodes: " + str(left_shortcodes))
return output

def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None):
"""New interface. Might be removed at some time."""
context = Context(hash(source_data), name=source_path)
html = self.__formatData(source_data, context)
return (html, []) # second part are shortcode dependencies

def compile_to_string(self, source_data, name=None, additional_data=None):
"""Old interface. Might be removed at some time."""
context = Context(hash(source_data), name=name, additional_data=additional_data)
return self.__formatData(source_data, context)

Expand Down

0 comments on commit d3b6c0d

Please sign in to comment.