More fixes for sphinx generated multi-language cross ref problem

This commit is contained in:
Kovid Goyal 2014-10-01 21:54:46 +05:30
parent 70ea6613b5
commit 8e462d8232
4 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@ use the edited ebook as input for conversion into other formats in |app|.
This document will refer mainly to the conversion settings as found in the This document will refer mainly to the conversion settings as found in the
conversion dialog, pictured below. All these settings are also available via conversion dialog, pictured below. All these settings are also available via
command line interface to conversion, documented at :ref:`ebook-convert`. In command line interface to conversion, documented at :doc:`generated/|lang|/ebook-convert`. In
|app|, you can obtain help on any individual setting by holding your mouse over |app|, you can obtain help on any individual setting by holding your mouse over
it, a tooltip will appear describing the setting. it, a tooltip will appear describing the setting.

View File

@ -53,7 +53,7 @@ CLI_INDEX='''
''' '''
CLI_PREAMBLE='''\ CLI_PREAMBLE='''\
.. _{cmd}: .. _{cmdref}:
``{cmd}`` ``{cmd}``
=================================================================== ===================================================================
@ -227,7 +227,7 @@ def cli_docs(app):
usage = usage[1:] usage = usage[1:]
usage = [i.replace(cmd, ':command:`%s`'%cmd) for i in usage] usage = [i.replace(cmd, ':command:`%s`'%cmd) for i in usage]
usage = '\n'.join(usage) usage = '\n'.join(usage)
preamble = CLI_PREAMBLE.format(cmd=cmd, cmdline=cmdline, usage=usage) preamble = CLI_PREAMBLE.format(cmd=cmd, cmdref=cmd + '-' + app.config.language, cmdline=cmdline, usage=usage)
if cmd == 'ebook-convert': if cmd == 'ebook-convert':
generate_ebook_convert_help(preamble, app) generate_ebook_convert_help(preamble, app)
elif cmd == 'calibredb': elif cmd == 'calibredb':
@ -247,7 +247,7 @@ def generate_docs(app):
def template_docs(app): def template_docs(app):
from template_ref_generate import generate_template_language_help from template_ref_generate import generate_template_language_help
raw = generate_template_language_help() raw = generate_template_language_help(app.config.language)
update_cli_doc('template_ref', raw, app) update_cli_doc('template_ref', raw, app)
def setup(app): def setup(app):

View File

@ -300,7 +300,7 @@ If you're satisfied with your recipe, and you feel there is enough demand to jus
.. seealso:: .. seealso::
:ref:`ebook-convert` :doc:`generated/|lang|/ebook-convert`
The command line interface for all ebook conversion. The command line interface for all ebook conversion.

View File

@ -7,7 +7,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
from collections import defaultdict from collections import defaultdict
PREAMBLE = '''\ PREAMBLE = '''\
.. _templaterefcalibre: .. _templaterefcalibre-{}:
Reference for all built-in template language functions Reference for all built-in template language functions
======================================================== ========================================================
@ -58,7 +58,7 @@ The python implementation of the template functions is passed in a Metadata obje
''' '''
def generate_template_language_help(): def generate_template_language_help(language):
from calibre.utils.formatter_functions import formatter_functions from calibre.utils.formatter_functions import formatter_functions
funcs = defaultdict(dict) funcs = defaultdict(dict)
@ -74,7 +74,7 @@ def generate_template_language_help():
func_cat = getattr(func, 'category') func_cat = getattr(func, 'category')
funcs[func_cat][func_sig] = class_name funcs[func_cat][func_sig] = class_name
output = PREAMBLE output = PREAMBLE.format(language)
cats = sorted(funcs.keys()) cats = sorted(funcs.keys())
for cat in cats: for cat in cats:
output += CATEGORY_TEMPLATE.format(category=cat, dashes='-'*len(cat)) output += CATEGORY_TEMPLATE.format(category=cat, dashes='-'*len(cat))