Rafael Martins avatar Rafael Martins committed dc36c00

improve docutils error handling

Comments (0)

Files changed (2)

 
     @locked_cached_property
     def parsed_source(self):
-        return parser(self.full, self._rst_header_level)
+        return parser(self.full, self._rst_header_level,
+                      ':repo:%s' % self.path)
 
     @locked_cached_property
     def parsed_abstract(self):
         if not self.read_more:
             return self.parsed_source
-        return parser(self.abstract, self._rst_header_level)
+        return parser(self.abstract, self._rst_header_level,
+                      ':repo:%s' % self.path)
 
     @locked_cached_property
     def author(self):

blohg/rst/__init__.py

     register_local_role(role, roles_index[role])
 
 
-def parser(content, rst_header_level):
+def parser(content, rst_header_level, source_path=None):
     settings = {'input_encoding': 'utf-8', 'output_encoding': 'utf-8',
                 'initial_header_level': rst_header_level,
                 'docinfo_xform': 0, 'field_name_limit': None}
-    parts = publish_parts(source=content, writer=BlohgWriter(),
-                          settings_overrides=settings)
+    parts = publish_parts(source=content, source_path=source_path,
+                          writer=BlohgWriter(), settings_overrides=settings)
     return {'title': parts['title'], 'fragment': parts['fragment'],
             'first_paragraph_as_text': parts['first_paragraph_as_text'],
             'images': parts['images']}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.