Generally, you don’t have to know read here. Please read yogosyu extension.
通常はこの頁を読む必要はありません。使い方などについてはyogosyu拡張(日本語版説明書)をご覧ください。
Module user_order_index_patch¶
The Sphinx extension to fix generating genindex.html for sortorder.
| copyright: | © 2011-2015 by Suzumizaki-Kimitaka(about Additional works) |
|---|---|
| license: | 2-clause BSD. |
This is the extension for Sphinx.
This extension hacks sphinx.environment.BuildEnvironment.create_index().
No roles, directives, domains or etc. will be added.
-
user_ordered_index_patch.determine_sort_order(app) Determine sort order used in this module
Parameters: cfg (sphinx.config.Config) – you can give from Sphinx with app.config,builder.configetc.Return type: None Returns: None
-
user_ordered_index_patch.keyfunc(entry) Sort the index entries
Parameters: entry (composited) – the element to sort. entry[0] is the name of it. Return type: str(Python 3) or unicode(Python 2) Returns: the comparable string to sort. Called by
my_env_buildenv_create_index()- entry[0] is the name of the entry
- entry[1] is a tuple
- entry[1][0] is a list of the urls include filename, extension and anchor to the entry.
- entry[1][1] is the dict of subwords.
the entries are generated by
sphinx.environment.BuildEnvironment.add_entry()defined insidesphinx.environment.BuildEnvironment.create_index(). (also means insidemy_env_buildenv_create_index())
-
user_ordered_index_patch.keyfunc2(item) Group the entries by letter.
Parameters: item (sortkey_content_pair) – the tuple (sortkey, content) Return type: str(Python 3) or unicode(Python 2) Returns: the group name in which (k, v) entry belongs. Seealso: keyfunc()Called by
my_env_buildenv_create_index().See note written in the document of
keyfunc().
-
user_ordered_index_patch.my_env_buildenv_create_index(self, builder, group_entries=True, _fixre=<_sre.SRE_Pattern object>) Hack function to alter sphinx.environment.BuildEnvironment.create_index
In real, this function is almost same as
sphinx.environment.BuildEnvironment.create_index()except:- keyfunc and keyfunc2 are not inner function
- setup _name_to_yomi dictionary at first
- both python 2.7.6 and python 3.3 compatible
-
user_ordered_index_patch.setup(app) Extend the Sphinx as we want, called from the Sphinx
Parameters: app (sphinx.application.Sphinx) – the object to add builder or something.
-
user_ordered_index_patch.yomi_or_given(s) Return sort-key or given string if not found one
Parameters: s (str_or_unicode) – the string refer to one of entry Return type: str(Python 3) or unicode(Python 2) Returns: the sort-key refer to the entry or just s if sort-key not found