From 3a73b97a2e35bc2e3c52a5cc61a62026e608bf79 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Fri, 9 Jan 2015 15:39:05 +0530
Subject: [PATCH] Add link to the User Manual for snippets
---
src/calibre/gui2/tweak_book/editor/snippets.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/calibre/gui2/tweak_book/editor/snippets.py b/src/calibre/gui2/tweak_book/editor/snippets.py
index 62c5d8f665..8820d90b0b 100644
--- a/src/calibre/gui2/tweak_book/editor/snippets.py
+++ b/src/calibre/gui2/tweak_book/editor/snippets.py
@@ -22,6 +22,7 @@ from calibre.gui2.tweak_book.editor.smarts.utils import get_text_before_cursor
from calibre.gui2.tweak_book.widgets import Dialog, PlainTextEdit
from calibre.utils.config import JSONConfig
from calibre.utils.icu import string_length as strlen
+from calibre.utils.localization import localize_user_manual_link
string_length = lambda x: strlen(unicode(x)) # Needed on narrow python builds, as subclasses of unicode dont work
@@ -54,7 +55,7 @@ obtain some advantage from it? But.
snip_key('<<', 'html', 'xml'): {
'description': _('Insert a tag'),
- 'template': '<$1>${2*}$1>',
+ 'template': '<$1>${2*}$1>$3',
},
snip_key('<>', 'html', 'xml'): {
@@ -64,7 +65,7 @@ obtain some advantage from it? But.
snip_key('${2*}',
+ 'template': '${2*}$3',
},
snip_key('
snip_key('${3*}$1>',
+ 'template': '<$1 class="${2:classname}">${3*}$1>$4',
},
} # }}}
@@ -446,6 +447,10 @@ class EditSnippet(QWidget):
self.heading = la = QLabel('\xa0')
add_row(la)
+ self.helpl = la = QLabel(_('For help with snippets, see the User Manual') %
+ localize_user_manual_link('http://manual.calibre-ebook.com/snippets.html'))
+ la.setOpenExternalLinks(True)
+ add_row(la)
self.name = n = QLineEdit(self)
n.setPlaceholderText(_('The name of this snippet'))