Set PWD to the open document path

Convert local paths to absolute on exporting preview and html
ui^2^2
Manuel Genovés 2020-01-25 01:19:25 +01:00
parent 0647b41340
commit d7df0c68f7
4 changed files with 3 additions and 5 deletions

View File

@ -6,7 +6,7 @@ function fix_path (path)
if string.starts(path, "/") then
return path
else
return (os.getenv('PANDOC_PREFIX') or '') .. path
return (pandoc.system.get_working_directory() or '') .. "/" .. path
end
end

View File

@ -238,7 +238,7 @@ class Export:
if export_type == "html":
to = "html5"
args.append("--standalone")
args.append("--self-contained")
args.append("--css=%s" % Theme.get_current().web_css_path)
args.append("--mathjax")
args.append("--lua-filter=%s" % helpers.get_script_path('relative_to_absolute.lua'))

View File

@ -442,7 +442,6 @@ class MainWindow(StyledWindow):
return
if filename:
print(urllib.parse.unquote(filename))
if filename.startswith('file://'):
filename = urllib.parse.unquote(filename)[7:]
self.text_view.clear()
@ -520,7 +519,6 @@ class MainWindow(StyledWindow):
def open_recent(self, _widget, data=None):
"""open the given recent document
"""
print("open")
if data:
if self.check_change() == Gtk.ResponseType.CANCEL:
@ -631,6 +629,7 @@ class MainWindow(StyledWindow):
if filename:
self.filename = filename
base_path = os.path.dirname(self.filename)
os.chdir(base_path)
else:
self.filename = None
base_path = "/"

View File

@ -57,7 +57,6 @@ class DragDropHandler:
text_buffer.delete(cursor_iter_l, cursor_iter_r)
if text.startswith(("http://", "https://", "www.")):
print("web")
text = "[{}]({})".format(_("web page"), text)
limit_left = 1
limit_right = len(_("web page"))