Created
September 4, 2019 12:27
-
-
Save chihchun/bb255a93154bcf6ea163bce3c23a0e27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 0f61a104560ae939aefd96f73632f6728f4dcf7d Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Rex=20Tsai=20=28=E8=94=A1=E5=BF=97=E5=B1=95=29?= | |
<[email protected]> | |
Date: Sun, 13 Aug 2017 19:24:57 +0800 | |
Subject: [PATCH 1/2] clipoboard: preferred to copy absolute link. | |
--- | |
zim/gui/clipboard.py | 3 ++- | |
1 file changed, 2 insertions(+), 1 deletion(-) | |
diff --git a/zim/gui/clipboard.py b/zim/gui/clipboard.py | |
index 3bd282a..ca16450 100644 | |
--- a/zim/gui/clipboard.py | |
+++ b/zim/gui/clipboard.py | |
@@ -279,7 +279,8 @@ def _link_tree(links, notebook, path): | |
if type == 'page': | |
target = Path(Path.makeValidPageName(link)) # Assume links are always absolute | |
href = notebook.pages.create_link(path, target) | |
- link = href.to_wiki_link() | |
+ # preferred to copy absolute link | |
+ # link = href.to_wiki_link() | |
elif type == 'file': | |
file = File(link) # Assume links are always URIs | |
link = notebook.relative_filepath(file, path) or file.uri | |
-- | |
2.7.4 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2d5c4a3b23ec5990ea54dc5f571e7de98047c982 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Rex=20Tsai=20=28=E8=94=A1=E5=BF=97=E5=B1=95=29?= | |
<[email protected]> | |
Date: Sun, 13 Aug 2017 20:46:20 +0800 | |
Subject: [PATCH 2/2] notebook: prefer to keep absolute links when renamed | |
pages. | |
--- | |
zim/notebook/notebook.py | 2 ++ | |
1 file changed, 2 insertions(+) | |
diff --git a/zim/notebook/notebook.py b/zim/notebook/notebook.py | |
index 4e6c6e2..5fbb05d 100644 | |
--- a/zim/notebook/notebook.py | |
+++ b/zim/notebook/notebook.py | |
@@ -769,6 +769,8 @@ class Notebook(ConnectorMixin, SignalEmitter): | |
else: | |
newhref = self.pages.create_link(source, target) | |
+ # prefer to keep absolute links | |
+ newhref = HRef(HREF_REL_ABSOLUTE, target.name) | |
text = newhref.to_wiki_link() | |
if elt.gettext() == elt.get('href'): | |
elt[:] = [text] | |
-- | |
2.7.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment