Generally, you don’t have to know read here. Please read yogosyu extension.

通常はこの頁を読む必要はありません。使い方などについてはyogosyu拡張(日本語版説明書)をご覧ください。

Module yogosyu

The Sphinx extension to provide yomigana to glossary.

copyright:© 2011-2015 by Suzumizaki-Kimitaka(only for additional works)
license:2-clause BSD.

This is the extension for Sphinx to add the yogosyu directive used to replace glossary.

The yogosyu directive can sort the terms by the order given from the user(document writer). Especially to support the language like Japanese, :yomimark: option is exist and make the way adding the reading(shows how to read) to each term.

This module depends on the module sortorder. The document of the module shows how to make your own order for the languages you want.

yomimark can be one of single_char_or_whitespace_or_unicode. the acceptable words are defined in docutils.parsers.rst.directives as follows:

  • one of the words: tab space
  • any single unicode character except white-spaces
  • the character itself, or the code point represented by:
    • the decimal number
    • the hexadecimal number prefixed x, x, U+, u, or u
    • XML style like ☮

The every term is splited by yomimark. 1st is the term itself, 2nd is treated as Yomigana(how to read). Currently 3rd and followers are simply ignored, but using this way, the ‘mono ruby’ may be supported for the future. (see HTML ruby module for example.)

Not all the entry have to give yomigana. When yomigana is not assigned, the name of the entry is used to sort.

yomigana itself is currently not shown in output HTML files. They’re only used to sort.

class yogosyu.Yogosyu(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Yomigana featured version of sphinx.domains.std.Glossary

Directive to create a glossary with cross-reference targets for :term: roles. The option yomimark is added.

The base class is docutils.parsers.rst.Directive. The option parser is defined in the module docutils.parsers.rst.directives.

run()

Inherit sphinx.util.compatDerective.run

Base codes are copied from the module sphinx.domains.std.Glossary.

yogosyu.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.config etc.
Return type:None
Returns:None
yogosyu.make_term_from_paragraph_node(termnodes, ids)

Copied function of sphinx.domains.std.term_from_paragraph_node()

Currently, no lines are modified. Called from Yogosyu.run().

yogosyu.make_termnodes_from_paragraph_node(env, node_and_yomi, new_id=None)

helper function of Yogosyu.run()

Parameters:
  • node_and_yomi (tuple) – the entry
  • new_id (str_or_unicode_or_None) – give the id if you already made.

Copied from sphinx.domains.std, modified 2 blocks and the 2nd parameter.

yogosyu.my_domains_std_StandardDomain_get_objects(self)

Defined to override sphinx.domains.std.StandardDomain.get_objects().

yogosyu.setup(app)

Extend the Sphinx as we want, called from the Sphinx

Parameters:app (sphinx.application.Sphinx) – the object to add builder or something.
yogosyu.wrap_make_refnode(org_method)

Defined to override sphinx.util.nodes.make_refnode().