@@ -66,14 +66,12 @@ def read_metadata(self, post, file_metadata_regexp=None, unslugify_titles=False,
66
66
return {}
67
67
if lang is None :
68
68
lang = LocaleBorg ().current_lang
69
- source = post .translated_source_path (lang )
70
-
71
- with io .open (source , 'r' , encoding = 'utf-8' ) as inf :
72
- document = docutils .core .publish_doctree (
73
- inf .read (), reader_name = 'standalone' ,
74
- settings_overrides = {'expose_internals' :
75
- ['refnames' , 'do_not_expose' ],
76
- 'report_level' : 5 })
69
+ source_path = post .translated_source_path (lang )
70
+
71
+
72
+ with io .open (source_path , 'r' , encoding = 'utf-8' ) as inf :
73
+ data = inf .read ()
74
+ _ , _ , _ , document = rst2html (data , logger = self .logger , source_path = source_path , transforms = self .site .rst_transforms , no_title_transform = False )
77
75
meta = {}
78
76
if 'title' in document :
79
77
meta ['title' ] = document ['title' ]
@@ -120,7 +118,7 @@ def compile_string(self, data, source_path=None, is_two_file=True, post=None, la
120
118
new_data , shortcodes = sc .extract_shortcodes (data )
121
119
if self .site .config .get ('USE_REST_DOCINFO_METADATA' ):
122
120
self .site .rst_transforms .append (RemoveDocinfo )
123
- output , error_level , deps = rst2html (
121
+ output , error_level , deps , _ = rst2html (
124
122
new_data , settings_overrides = settings_overrides , logger = self .logger , source_path = source_path , l_add_ln = add_ln , transforms = self .site .rst_transforms ,
125
123
no_title_transform = self .site .config .get ('NO_DOCUTILS_TITLE_TRANSFORM' , False ))
126
124
if not isinstance (output , unicode_str ):
@@ -334,9 +332,10 @@ def rst2html(source, source_path=None, source_class=docutils.io.StringInput,
334
332
pub .set_source (source , None )
335
333
pub .settings ._nikola_source_path = source_path
336
334
pub .set_destination (None , destination_path )
335
+ from doit .tools import set_trace ; set_trace ()
337
336
pub .publish (enable_exit_status = enable_exit_status )
338
337
339
- return pub .writer .parts ['docinfo' ] + pub .writer .parts ['fragment' ], pub .document .reporter .max_level , pub .settings .record_dependencies
338
+ return pub .writer .parts ['docinfo' ] + pub .writer .parts ['fragment' ], pub .document .reporter .max_level , pub .settings .record_dependencies , pub . document
340
339
341
340
342
341
# Alignment helpers for extensions
0 commit comments