mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Comments editor: Add an action to the context menu to smarten punctuation. Fixes #1876381 [Feature request: Smarten punctuation in metadata](https://bugs.launchpad.net/calibre/+bug/1876381)
This commit is contained in:
parent
a8649d2e96
commit
55e3688097
@ -805,6 +805,8 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
||||
if hasattr(parent, 'toolbars_visible'):
|
||||
vis = parent.toolbars_visible
|
||||
menu.addAction(_('%s toolbars') % (_('Hide') if vis else _('Show')), parent.toggle_toolbars)
|
||||
menu.addSeparator()
|
||||
menu.addAction(_('Smarten punctuation'), parent.smarten_punctuation)
|
||||
menu.exec_(ev.globalPos())
|
||||
|
||||
# }}}
|
||||
@ -1192,6 +1194,13 @@ class Editor(QWidget): # {{{
|
||||
def hide_tabs(self):
|
||||
self.tabs.tabBar().setVisible(False)
|
||||
|
||||
def smarten_punctuation(self):
|
||||
from calibre.ebooks.conversion.preprocess import smarten_punctuation
|
||||
html = self.html
|
||||
newhtml = smarten_punctuation(html)
|
||||
if html != newhtml:
|
||||
self.html = newhtml
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user