mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Proper titlecasing for generated group titles in cli manual pages
This commit is contained in:
parent
72cd6ee29a
commit
a619ed9ce4
@ -72,6 +72,12 @@ CLI_PREAMBLE='''\
|
|||||||
{usage}
|
{usage}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
def titlecase(app, x):
|
||||||
|
if x and app.config.language == 'en':
|
||||||
|
from calibre.utils.titlecase import titlecase as tc
|
||||||
|
x = tc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
def generate_calibredb_help(preamble, app):
|
def generate_calibredb_help(preamble, app):
|
||||||
from calibre.library.cli import COMMANDS, get_parser
|
from calibre.library.cli import COMMANDS, get_parser
|
||||||
import calibre.library.cli as cli
|
import calibre.library.cli as cli
|
||||||
@ -86,7 +92,7 @@ def generate_calibredb_help(preamble, app):
|
|||||||
global_parser = get_parser('')
|
global_parser = get_parser('')
|
||||||
groups = []
|
groups = []
|
||||||
for grp in global_parser.option_groups:
|
for grp in global_parser.option_groups:
|
||||||
groups.append((grp.title, grp.description, grp.option_list))
|
groups.append((titlecase(app, grp.title), grp.description, grp.option_list))
|
||||||
|
|
||||||
global_options = '\n'.join(render_options('calibredb', groups, False, False))
|
global_options = '\n'.join(render_options('calibredb', groups, False, False))
|
||||||
|
|
||||||
@ -114,7 +120,7 @@ def generate_calibredb_help(preamble, app):
|
|||||||
for group in parser.option_groups:
|
for group in parser.option_groups:
|
||||||
if not getattr(group, 'is_global_options', False):
|
if not getattr(group, 'is_global_options', False):
|
||||||
lines.extend(render_options(
|
lines.extend(render_options(
|
||||||
'calibredb_' + cmd, [[group.title, group.description, group.option_list]], False, False, header_level='^'))
|
'calibredb_' + cmd, [[titlecase(app, group.title), group.description, group.option_list]], False, False, header_level='^'))
|
||||||
lines += ['']
|
lines += ['']
|
||||||
|
|
||||||
raw = preamble + '\n\n'+'.. contents::\n :local:'+ '\n\n' + global_options+'\n\n'+'\n'.join(lines)
|
raw = preamble + '\n\n'+'.. contents::\n :local:'+ '\n\n' + global_options+'\n\n'+'\n'.join(lines)
|
||||||
@ -132,7 +138,7 @@ def generate_ebook_convert_help(preamble, app):
|
|||||||
groups = [(None, None, parser.option_list)]
|
groups = [(None, None, parser.option_list)]
|
||||||
for grp in parser.option_groups:
|
for grp in parser.option_groups:
|
||||||
if grp.title not in {'INPUT OPTIONS', 'OUTPUT OPTIONS'}:
|
if grp.title not in {'INPUT OPTIONS', 'OUTPUT OPTIONS'}:
|
||||||
groups.append((grp.title.title(), grp.description, grp.option_list))
|
groups.append((titlecase(app, grp.title), grp.description, grp.option_list))
|
||||||
options = '\n'.join(render_options('ebook-convert', groups, False))
|
options = '\n'.join(render_options('ebook-convert', groups, False))
|
||||||
|
|
||||||
raw += '\n\n.. contents::\n :local:'
|
raw += '\n\n.. contents::\n :local:'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user