hexo-zhruby -- Implementing HTML Ruby tag in Hexo

  1. Install
  2. Use cases
  3. Usage
    1. For the 1st use case (pronunciation indication):
    2. For the 2nd use case (Gikun):
  4. Known issues
  5. References

Implement the HTML tag <ruby> for Hexo using Tag Plugin feature. Provide auto pronounciation indication for Jyutping (Cantonese), Zhuyin (Taiwanese Mandarin), and Pinyin (Chinese Mandarin), and the default setting for general usage. Support Traditonal and Simplified Chinese characters.

Inspired by the hexo-ruby-character by jamespan.

Install

npm install hexo-zhruby --save

Use cases

Ruby (ルビ) is also known as Furigana (振り仮名). It contains two basic use cases:

  1. To clarify or indicate the pronunciation for readers
  2. Gikun, in which the characters have different pronunciations than they seem due to convention or for a specific context. For example, the pronunciation of 煙草 in Japanese is tabako (tobacco).

Usage

TLDR: Usage: {% tag rb|rt %}; Tag options: ruby_def, ruby_jy, ruby_py, ruby_zy.


For the 1st use case (pronunciation indication):

ruby_def allows any language, and the spacing in rp will expand evenly with respect to the word length in rt.

  • {% ruby_def 基本|きほん %}基本 (きほん)
  • {% ruby_def 基本|기본 %}基本 (기본)
  • {% ruby_def 基本|fundamental %}基本 (fundamental)
  • {% ruby_def 基本|θεμελιώδες %}基本 (θεμελιώδες)
  • {% ruby_def 基本|базовый %}基本 (базовый)
  • {% ruby_def 基本|základní %}基本 (základní)
  • {% ruby_def fundamental|基本 %}fundamental (基本)

ruby_jy, ruby_py, ruby_zy refers to Jyutping, Pinyin, Zhuyin respectively.

No need to enter the pronunciation manually in rt; the value will automatically be returned.

  • {% ruby_zy 基本 %}基本 (ㄐㄧ ㄅㄣˇ)
  • {% ruby_py 基本 %}基本 (jī běn)
  • {% ruby_jy 基本 %}基本 (gei1 bun2)

For the 2nd use case (Gikun):

Same usage for ruby_def.

  • {% ruby_def special|basic %}special (basic)
  • {% ruby_def 特別|基本 %}特別 (基本)

In ruby_jy, ruby_py, ruby_zy, you can also add |rt just like ruby_def.

  • {% ruby_zy 特別|special %}特別 (special)
  • {% ruby_py 特別|special %}特別 (special)
  • {% ruby_jy 特別|special %}特別 (special)
  • {% ruby_zy 特別|基本 %}特別 (ㄐㄧ ㄅㄣˇ)
  • {% ruby_py 特別|基本 %}特別 (jī běn)
  • {% ruby_jy 特別|基本 %}特別 (gei1 bun2)

Notice that the rt output depends on the pronunciation in rt, but not rp. This feature is only available when rt is a Chinese Character in CJK Unified Ideographs (\U4E00-\U9FFF).

If the input of rt is not in CJK Unified Ideographs, it is considered as ruby_def.

Known issues

The Chinese language contains a lot of Homophones, which can be resolved by context most of the time. However, for long sentences (>= 15 characters), or very specific names and terms, the auto-generation from 1st use case may not be very sensitive.

Please use ruby_def if it happens or contribute to this project by providing a more sensitive or advanced Chinese vocabulary library.

References


Please cite the source for reprints, feel free to verify the sources cited in the article, and point out any errors or lack of clarity of expression. You can comment in the comments section below or email to GreenMeeple@yahoo.com
This Repo