mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
HTMLZ output options UI
This commit is contained in:
parent
7a2e621029
commit
619e855c1b
@ -21,30 +21,41 @@ class HTMLZOutput(OutputFormatPlugin):
|
|||||||
author = 'John Schember'
|
author = 'John Schember'
|
||||||
file_type = 'htmlz'
|
file_type = 'htmlz'
|
||||||
commit_name = 'htmlz_output'
|
commit_name = 'htmlz_output'
|
||||||
|
ui_data = {
|
||||||
|
'css_choices': {
|
||||||
|
'class': _('Use CSS classes'),
|
||||||
|
'inline': _('Use the style attribute'),
|
||||||
|
'tag': _('Use HTML tags wherever possible')
|
||||||
|
},
|
||||||
|
'sheet_choices': {
|
||||||
|
'external': _('Use an external CSS file'),
|
||||||
|
'inline': _('Use a <style> tag in the HTML file')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
options = set([
|
options = {
|
||||||
OptionRecommendation(name='htmlz_css_type', recommended_value='class',
|
OptionRecommendation(name='htmlz_css_type', recommended_value='class',
|
||||||
level=OptionRecommendation.LOW,
|
level=OptionRecommendation.LOW,
|
||||||
choices=['class', 'inline', 'tag'],
|
choices=list(ui_data['css_choices']),
|
||||||
help=_('Specify the handling of CSS. Default is class.\n'
|
help=_('Specify the handling of CSS. Default is class.\n'
|
||||||
'class: Use CSS classes and have elements reference them.\n'
|
'class: {class}\n'
|
||||||
'inline: Write the CSS as an inline style attribute.\n'
|
'inline: {inline}\n'
|
||||||
'tag: Turn as many CSS styles as possible into HTML tags.'
|
'tag: {tag}'
|
||||||
)),
|
).format(**ui_data['css_choices'])),
|
||||||
OptionRecommendation(name='htmlz_class_style', recommended_value='external',
|
OptionRecommendation(name='htmlz_class_style', recommended_value='external',
|
||||||
level=OptionRecommendation.LOW,
|
level=OptionRecommendation.LOW,
|
||||||
choices=['external', 'inline'],
|
choices=list(ui_data['sheet_choices']),
|
||||||
help=_('How to handle the CSS when using css-type = \'class\'.\n'
|
help=_('How to handle the CSS when using css-type = \'class\'.\n'
|
||||||
'Default is external.\n'
|
'Default is external.\n'
|
||||||
'external: Use an external CSS file that is linked in the document.\n'
|
'external: {external}\n'
|
||||||
'inline: Place the CSS in the head section of the document.'
|
'inline: {inline}'
|
||||||
)),
|
).format(**ui_data['sheet_choices'])),
|
||||||
OptionRecommendation(name='htmlz_title_filename',
|
OptionRecommendation(name='htmlz_title_filename',
|
||||||
recommended_value=False, level=OptionRecommendation.LOW,
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
help=_('If set this option causes the file name of the HTML file'
|
help=_('If set this option causes the file name of the HTML file'
|
||||||
' inside the HTMLZ archive to be based on the book title.')
|
' inside the HTMLZ archive to be based on the book title.')
|
||||||
),
|
),
|
||||||
])
|
}
|
||||||
|
|
||||||
def convert(self, oeb_book, output_path, input_plugin, opts, log):
|
def convert(self, oeb_book, output_path, input_plugin, opts, log):
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
@ -711,6 +711,16 @@ def txtz_output(container):
|
|||||||
return txt_output(container)
|
return txt_output(container)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
# HTMLZ Output {{{
|
||||||
|
@ep
|
||||||
|
def htmlz_output(container):
|
||||||
|
g = E.div(class_='simple-group')
|
||||||
|
container.appendChild(g)
|
||||||
|
g.appendChild(choices('htmlz_css_type', _('How to handle &CSS'), ui_data.css_choices))
|
||||||
|
g.appendChild(choices('htmlz_class_style', _('How to handle &CSS'), ui_data.sheet_choices))
|
||||||
|
g.appendChild(checkbox('htmlz_title_filename', _('Use book title as the filename for the HTML file')))
|
||||||
|
# }}}
|
||||||
|
|
||||||
def restore_defaults():
|
def restore_defaults():
|
||||||
for setting in registry:
|
for setting in registry:
|
||||||
set(setting, get_option_default_value(setting))
|
set(setting, get_option_default_value(setting))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user