suminb/hanja

Combination Modes

suminb opened this issue · 0 comments

We currently have combination mode where Hanja characters are converted into Hangul while preserving the original text in parentheses. Each class of characters are contained different <span> tags to differentiate semantics.

>>> hanja.translate(u'大韓民國은 **共和國이다.', 'combination')
<span class="hanja">大韓民國</span><span class="hangul">(대한민국)</span>은 <span class="hanja">**共和國</span><span class="hangul">(민주공화국)</span>이다.

However, I thought it would be useful to provide a text-only combination mode, assuming not everyone uses this library to produce HTML.

>>> hanja.translate(u'大韓民國은 **共和國이다.', 'combination-html')
<span class="hanja">大韓民國</span><span class="hangul">(대한민국)</span>은 <span class="hanja">**共和國</span><span class="hangul">(민주공화국)</span>이다.

>>> hanja.translate(u'大韓民國은 **共和國이다.', 'combination-text')
大韓民國(대한민국)은 **共和國(민주공화국)이다.

Backward compatibility may be preserved by making the legacy combination mode fall back to combination-html.