Skip to main content

KanaText class extends the functionality of Text class, for someone who use index/glossary directives.

Project description

extends the functionality of the Text class. any person, who use index/glossary directives with Japanse Kanji, is to be so happy.

https://i.gyazo.com/4cbf3408c162fb2bfcc493661d35a42b.png

QUICK START

conf.py:

extensions = ['sphinxcontrib.kana_text']
#html_kana_text_on_genindex = False
#html_kana_text_use_own_indexer = 'large'

rst file:

.. index:: ようご|用語^21
.. glossary::

   ようごいち|用語壱^212
     用語1の説明。
夜空に浮かぶ\ :index:`あまた|数多^21`\ の星々が\ :kana:`きらめいて|煌めいて^2c`\ いる。
https://i.gyazo.com/63fe4ccfaa8a57bb2d8db50c0a689cad.png

build:

$ make kana

genindex.html

$ sphinx-kana-genindex
$ mv genindex.html.sample path_to_sphinx_project/_templates/genindex.html

CHANGES

  • 2021-10-08 0.22 refactoring: IndexRack, IndexUnit.

  • 2021-10-04 0.21 refactoring: KanaText, KanaTextUnit.

  • 2021-09-30 0.20 refactoring: unittest.

  • 2021-09-30 0.19 handle homonymous functions by each name.

  • 2021-09-28 0.18 command ‘sphinx-kana-genindex’

  • 2021-09-27 0.17 released on pypi.

DEVELOPMENT

structure of the data for genindex.html

  • genidex: [(classifier, terms)]

    • classifier: Text/KanaText

    • terms: [(term, list)]

      • term: Text/KanaText

      • list: [links, subterms, index_key]

        • links: [(main, uri)]

        • subterms: [(subterm, links)]

          • subterm: Text/KanaText

          • links: [(main, uri)]

        • index_key: str

variable name

  • term: KanaText OBJect. it might be ktobj.

  • rawtext: ex. ‘かな|言葉^11’, ‘かな|言葉^11; い|壱^1’ or ‘かな|言葉^11; い|壱^1; ろ|弐^1`

  • rawsouce: means Elemnt.rawsource.

  • text: the string ‘かな|言葉’ of ‘かな|言葉^11’, by object.asword() of KanaText.

  • hier: the string ‘言葉’ of ‘かな|言葉^11’, by object.ashier() which means hieroglyph.

  • kana: the string ‘かな’ of ‘かな|言葉^11’. by object.askana()

  • html: ex. ‘<ruby><rb>言葉</by><rp></rp><rt>かな</rt><rp></rp></ruby>’

  • latex: (T.B.D.)

  • epub: (T.B.D.)

  • separator: used by re.split()

  • delimiter: used by object.astext(), etc.

  • option marker: the ‘^’ of ‘かな|言葉^11’

KanaText(ex. ‘かな|言葉^11’)

  • object[0]: ‘言葉’

  • object[1]: ‘かな’

  • object[‘separator’]: ‘|’

  • object[‘ruby’]: ‘specific’

  • object[‘option’]: ‘11’

KanaTextUnit(ex. ‘ああ|壱壱^11; いい|弐弐^11; うう|参参^11’)

  • object[0]: KanaText(‘ああ|壱壱^11’)

  • object[1]: KanaText(‘いい|弐弐^11’)

  • object[2]: KanaText(‘うう|参参^11’)

  • object[‘entry_type’]: ‘single’, ‘pair’, ‘triple’, ‘see’ or ‘seealso’

  • object[‘file_name’]: file name

  • object[‘target’]: target id

  • object[‘main’]: ‘main’ or ‘’

  • object[‘index_key’]: None or classifier

  • object.make_IndexUnit(): return [IndexUnit, IndexUnit, …]

TextUnit(T.B.D.)

  • object[0]: Text(rawtext)

  • object[1]: Text(rawtext)

  • object[2]: Text(rawtext)

  • object[‘entry_type’]: ‘single’, ‘pair’, ‘triple’, ‘see’ or ‘seealso’

  • object[‘file_name’]: a file name

  • object[‘target’]: a target id

  • object[‘main’]: ‘main’ or ‘’

  • object[‘index_key’]: None or classifier

  • object.make_index_unit(): return [IndexUnit, IndexUnit, …]

IndexUnit

  • object._sortkey: for emphasis which means ‘main’.

  • object[0]: KanaText(classifier)

  • object[1]: KanaText(main term)

  • object[2]: [], [KanaText(2nd)], or [KanaText(2nd), KanaText(3rd)]

  • object[3]: emphasis code (‘main’: 1, ‘’: 5, ‘see’: 8, ‘seealso’: 9)

  • object[‘file_name’]: target file

  • object[‘target’]: target id

  • object[‘main’]: emphasis

  • object[‘index_key’]: None or classifier

  • object.delimiter: ‘ ‘ or ‘, ‘

IndexRack

  • object[n]: IndexUnit(…)

  • object.append(): make/update classifier_catalog and kana_katalog

  • object.extend(): call the object.append() by each IndexUnit object

  • object.udpate(): update IndexUnit object with classifier_catalog and kana_catalog

  • object.sort(): to be sorted

  • object.generate_genindex_data()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxcontrib.kana_text-0.22.1.2.tar.gz (21.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page