@@ -83,21 +83,19 @@ def _compile_content(self, compiler_name, content, filename):
83
83
_LOGGER .error ("Cannot find page compiler '{0}' for comment {1}!" .format (compiler_name , filename ))
84
84
exit (1 )
85
85
compiler = self .site .compilers [compiler_name ]
86
- if compiler_name == 'rest' :
87
- content , error_level , _ , _ = compiler .compile_string (content )
88
- if error_level >= 3 :
86
+ try :
87
+ result = compiler .compile_string (content , source_path = filename , is_two_file = True , lang = self .site .default_lang )
88
+ if compiler_name == 'rest' and result [1 ] >= 3 :
89
+ # The reStructured Text page compiler returns error_level as second return value
89
90
_LOGGER .error ("reStructuredText page compiler ({0}) failed to compile comment {1}!" .format (compiler_name , filename ))
90
91
exit (1 )
91
- return content
92
- else :
92
+ return result [ 0 ]
93
+ except ( AttributeError , NotImplementedError ) :
93
94
try :
94
- return compiler .compile_string (content )[0 ]
95
- except (AttributeError , NotImplementedError ):
96
- try :
97
- return compiler .compile_to_string (content )
98
- except AttributeError :
99
- _LOGGER .error ("Page compiler plugin '{0}' provides no compile_string or compile_to_string function (comment {1})!" .format (compiler_name , filename ))
100
- exit (1 )
95
+ return compiler .compile_to_string (content )
96
+ except AttributeError :
97
+ _LOGGER .error ("Page compiler plugin '{0}' provides no compile_string or compile_to_string function (comment {1})!" .format (compiler_name , filename ))
98
+ exit (1 )
101
99
102
100
def _read_comment (self , filename , owner , id ):
103
101
"""Read a comment from a file."""
0 commit comments