mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
TXT output options UI
This commit is contained in:
parent
9bad72f2cc
commit
7a2e621029
@ -21,6 +21,14 @@ class TXTOutput(OutputFormatPlugin):
|
||||
author = 'John Schember'
|
||||
file_type = 'txt'
|
||||
commit_name = 'txt_output'
|
||||
ui_data = {
|
||||
'newline_types': NEWLINE_TYPES,
|
||||
'formatting_types': {
|
||||
'plain': _('Plain text'),
|
||||
'markdown': _('Markdown formatted text'),
|
||||
'textile': _('TexTile formatted text')
|
||||
},
|
||||
}
|
||||
|
||||
options = set([
|
||||
OptionRecommendation(name='newline', recommended_value='system',
|
||||
@ -50,11 +58,11 @@ class TXTOutput(OutputFormatPlugin):
|
||||
'is present. Also allows max-line-length to be below the minimum')),
|
||||
OptionRecommendation(name='txt_output_formatting',
|
||||
recommended_value='plain',
|
||||
choices=['plain', 'markdown', 'textile'],
|
||||
choices=list(ui_data['formatting_types']),
|
||||
help=_('Formatting used within the document.\n'
|
||||
'* plain: Produce plain text.\n'
|
||||
'* markdown: Produce Markdown formatted text.\n'
|
||||
'* textile: Produce Textile formatted text.')),
|
||||
'* plain: {plain}\n'
|
||||
'* markdown: {markdown}\n'
|
||||
'* textile: {textile}').format(**ui_data['formatting_types'])),
|
||||
OptionRecommendation(name='keep_links',
|
||||
recommended_value=False, level=OptionRecommendation.LOW,
|
||||
help=_('Do not remove links within the document. This is only '
|
||||
|
@ -677,6 +677,40 @@ def pml_output(container):
|
||||
g.appendChild(checkbox('full_image_depth', _('Do not &reduce image size and depth')))
|
||||
# }}}
|
||||
|
||||
# RB Output {{{
|
||||
@ep
|
||||
def rb_output(container):
|
||||
g = E.div(class_='simple-group')
|
||||
container.appendChild(g)
|
||||
g.appendChild(checkbox('inline_toc', _('&Inline TOC')))
|
||||
# }}}
|
||||
|
||||
# TXT Output {{{
|
||||
@ep
|
||||
def txt_output(container):
|
||||
g = E.div(class_='simple-group')
|
||||
container.appendChild(g)
|
||||
g.appendChild(lineedit('txt_output_encoding', _('O&utput encoding:')))
|
||||
g.appendChild(choices('newline', _('&Line ending style:'), ui_data.newline_types))
|
||||
g.appendChild(choices('txt_output_formatting', _('Forma&tting:'), ui_data.formatting_types))
|
||||
g = E.div(E.div(_('Options for plain text output:')), E.div(class_='simple-group', style='margin-left: 1rem; margin-top: 1ex'))
|
||||
container.appendChild(g)
|
||||
g = g.lastChild
|
||||
g.appendChild(checkbox('inline_toc', _('&Inline TOC')))
|
||||
g.appendChild(int_spin('max_line_length', _('&Maximum line length:'), max=1000))
|
||||
g.appendChild(checkbox('force_max_line_length', _('Force maximum line &length')))
|
||||
g = E.div(E.div(_('Options for Markdown and TexTile output:')), E.div(class_='simple-group', style='margin-left: 1rem; margin-top: 1ex'))
|
||||
container.appendChild(g)
|
||||
g = g.lastChild
|
||||
g.appendChild(checkbox('keep_links', _('Do not remove links (<a> tags) before processing')))
|
||||
g.appendChild(checkbox('keep_image_references', _('Do not remove image &references before processing')))
|
||||
g.appendChild(checkbox('keep_color', _('Keep text &color, when possible')))
|
||||
|
||||
@ep
|
||||
def txtz_output(container):
|
||||
return txt_output(container)
|
||||
# }}}
|
||||
|
||||
def restore_defaults():
|
||||
for setting in registry:
|
||||
set(setting, get_option_default_value(setting))
|
||||
|
Loading…
x
Reference in New Issue
Block a user