Add link to the User Manual for snippets

This commit is contained in:
Kovid Goyal 2015-01-09 15:39:05 +05:30
parent dfac0d2cd5
commit 3a73b97a2e

View File

@ -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.gui2.tweak_book.widgets import Dialog, PlainTextEdit
from calibre.utils.config import JSONConfig from calibre.utils.config import JSONConfig
from calibre.utils.icu import string_length as strlen 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 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.</p>
snip_key('<<', 'html', 'xml'): { snip_key('<<', 'html', 'xml'): {
'description': _('Insert a tag'), 'description': _('Insert a tag'),
'template': '<$1>${2*}</$1>', 'template': '<$1>${2*}</$1>$3',
}, },
snip_key('<>', 'html', 'xml'): { snip_key('<>', 'html', 'xml'): {
@ -64,7 +65,7 @@ obtain some advantage from it? But.</p>
snip_key('<a', 'html'): { snip_key('<a', 'html'): {
'description': _('Insert a HTML link'), 'description': _('Insert a HTML link'),
'template': '<a href="${1:filename}">${2*}</a>', 'template': '<a href="${1:filename}">${2*}</a>$3',
}, },
snip_key('<i', 'html'): { snip_key('<i', 'html'): {
@ -74,7 +75,7 @@ obtain some advantage from it? But.</p>
snip_key('<c', 'html'): { snip_key('<c', 'html'): {
'description': _('Insert a HTML tag with a class'), 'description': _('Insert a HTML tag with a class'),
'template': '<$1 class="${2:classname}">${3*}</$1>', 'template': '<$1 class="${2:classname}">${3*}</$1>$4',
}, },
} # }}} } # }}}
@ -446,6 +447,10 @@ class EditSnippet(QWidget):
self.heading = la = QLabel('<h2>\xa0') self.heading = la = QLabel('<h2>\xa0')
add_row(la) add_row(la)
self.helpl = la = QLabel(_('For help with snippets, see the <a href="%s">User Manual</a>') %
localize_user_manual_link('http://manual.calibre-ebook.com/snippets.html'))
la.setOpenExternalLinks(True)
add_row(la)
self.name = n = QLineEdit(self) self.name = n = QLineEdit(self)
n.setPlaceholderText(_('The name of this snippet')) n.setPlaceholderText(_('The name of this snippet'))