Re:
https://www.mobileread.com/forums/sho...d.php?t=230684.
I have enhanced ebook-polish to add a new command line parameter:
Code:
-s SMARTEN_PUNCTUATION_OPT, --smarten-punctuation-opt=SMARTEN_PUNCTUATION_OPT
SMARTEN_PUNCTUATION_OPT gets passed to smartyPants as the attr (the options which control which conversions are done). I have also added additional conversions (for space+hyphen to em-dash etc) to smartyPants.
This all works fine.
But I am not clear on exactly how edit-book can call my new smarten_punctuation_opt command (in ebooks\oeb\polish\main.py) with parameters:
So in gui2\tweak_book\ui.py I have
Code:
self.action_smarten_punctuation = reg(
'smarten-punctuation.png', _('&Smarten punctuation'), partial(
self.boss.polish, 'smarten_punctuation_opt', _('Smarten punctuation')), 'smarten-punctuation', (), _('Smarten punctuation'))
smarten_punctuation_opt is my new smarten punctuation in ebooks\oeb\polish\main.py:
Code:
if opts.smarten_punctuation_opt:
rt(_('Smartening punctuation'))
smarten_punctuation(ebook, opts.smarten_punctuation_opt, report)
#smarten_punctuation(ebook, "H", report)
report('')
(If I use the commented out line I get the "H" conversion, so I know this call works when the smarten_punctuation options are hard coded).
I need to able to set opts.smarten_punctuation_opt when I call this from edit-book (obviously edit book is also going to need a UI to specify the smarten punctuation options but I will worry about that later).