Search code examples
htmlcsspython-sphinxrestructuredtextruby-characters

ruby tags for Sphinx/rst


I create HTML documents from a rst-formated text, with the help of Sphinx. I need to display some Japanese words with furiganas (=small characters above the words), something like that : Japanese text with furiganas over some words

I'd like to produce HTML displaying furiganas thanks to the < ruby > tag.

I can't figure out how to get this result. I tried to:

  • insert raw HTML code with the .. raw:: html directive but it breaks my line into several paragraphs.
  • use the :superscript: directive but the text in furigana is written beside the text, not above.
  • use the :role: directive to create a link between the text and a CSS class of my own. But the :role: directive can only be applied to a segment of text, not to TWO segments as required by the furiganas (=text + text above it).

Any idea to help me ?


Solution

  • As long as I know, there's no simple way to get the expected result.

    For a specific project, I choosed not to generate the furiganas with the help of Sphinx but to modify the .html files afterwards. See the add_ons/add_furiganas.py script and the result here. Yes, it's a quick-and-dirty trick :(