Skip to content
Permalink
Browse files

Adding support for new compile_string interface (see getnikola/nikola…

  • Loading branch information
felixfontein committed Jan 8, 2017
1 parent 0e979a4 commit d3b6c0d4408152e84f86a829c1c7f5b5c77d757f
Showing with 8 additions and 1 deletion.
  1. +1 −1 v7/wordpress_compiler/wordpress/license.txt
  2. +7 −0 v7/wordpress_compiler/wordpress/wordpress.py
@@ -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
@@ -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)

0 comments on commit d3b6c0d

Please sign in to comment.
You can’t perform that action at this time.