[gnome-builder] rst preview: fix include files not found
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] rst preview: fix include files not found
- Date: Wed, 15 Mar 2017 16:27:42 +0000 (UTC)
commit 5e7e0672817e5d02b58820a62c178b52638bb929
Author: Sebastien Lafargue <slafargue gnome org>
Date: Wed Mar 15 17:18:19 2017 +0100
rst preview: fix include files not found
.../html-preview/html_preview_plugin/__init__.py | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/plugins/html-preview/html_preview_plugin/__init__.py
b/plugins/html-preview/html_preview_plugin/__init__.py
index 6f6cbe5..480ac31 100644
--- a/plugins/html-preview/html_preview_plugin/__init__.py
+++ b/plugins/html-preview/html_preview_plugin/__init__.py
@@ -21,6 +21,7 @@
import gi
import os
+import locale
gi.require_version('Gtk', '3.0')
gi.require_version('Ide', '1.0')
@@ -34,6 +35,11 @@ from gi.repository import Ide
from gi.repository import WebKit2
from gi.repository import Peas
+try:
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
can_preview_rst = True
try:
@@ -185,11 +191,15 @@ class HtmlPreviewView(Ide.LayoutView):
</html>
""" % params
- def get_rst(self, text):
- return publish_string(text, writer_name='html5')
+ def get_rst(self, text, path):
+ return publish_string(text,
+ writer_name='html5',
+ source_path=path,
+ destination_path=path)
def reload(self):
- base_uri = self.document.get_file().get_file().get_uri()
+ file = self.document.get_file().get_file()
+ base_uri = file.get_uri()
begin, end = self.document.get_bounds()
text = self.document.get_text(begin, end, True)
@@ -197,7 +207,7 @@ class HtmlPreviewView(Ide.LayoutView):
if self.markdown:
text = self.get_markdown(text)
elif self.rst:
- text = self.get_rst(text).decode("utf-8")
+ text = self.get_rst(text, file.get_path()).decode("utf-8")
self.webview.load_html(text, base_uri)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]