src/js/locale/h-ruby.js
function getZhuyinHTML( rt ) {
  // #### Explanation ####
  // * `zhuyin`: the entire phonetic annotation
  // * `yin`:    the plain pronunciation (w/out tone)
  // * `diao`:   the tone
  // * `len`:    the length of the plain pronunciation (`yin`)
  var zhuyin = typeof rt === 'string' ? rt : rt.textContent
  var yin, diao, len

  yin  = zhuyin.replace( TYPESET.zhuyin.diao, '' )
  len  = yin ? yin.length : 0
  diao = zhuyin
    .replace( yin, '' )
    .replace( /[\u02C5]/g, '\u02C7' )
    .replace( /[\u030D\u0358]/g, '\u0307' )
  return len === 0 ? '' : '<h-zhuyin length="' + len + '" diao="' + diao + '"><h-yin>' + yin + '</h-yin><h-diao>' + diao + '</h-diao></h-zhuyin>'
}
function getZhuyinHTML( rt ) {
  // #### Explanation ####
  // * `zhuyin`: the entire phonetic annotation
  // * `yin`:    the plain pronunciation (w/out tone)
  // * `diao`:   the tone
  // * `len`:    the length of the plain pronunciation (`yin`)
  var zhuyin = typeof rt === 'string' ? rt : rt.textContent
  var yin, diao, len

  yin  = zhuyin.replace( TYPESET.zhuyin.diao, '' )
  len  = yin ? yin.length : 0
  diao = zhuyin
    .replace( yin, '' )
    .replace( /[\u02C5]/g, '\u02C7' )
    .replace( /[\u030D\u0358]/g, '\u0307' )
  return len === 0 ? '' : '<h-zhuyin length="' + len + '" diao="' + diao + '"><h-yin>' + yin + '</h-yin><h-diao>' + diao + '</h-diao></h-zhuyin>'
}
function getZhuyinHTML ( rt ) { // #### Explanation #### // * `zhuyin`: the entire phonetic annotation // * `yin`:    the plain pronunciation (w/out tone) // * `diao`:   the tone // * `len`:    the length of the plain pronunciation (`yin`) var zhuyin = typeof rt === 'string' ? rt : rt . textContent var yin , diao , len yin = zhuyin . replace ( TYPESET . zhuyin . diao , '' ) len = yin ? yin . length : 0 diao = zhuyin . replace ( yin , '' ) . replace ( / [\u02C5] / g , '\u02C7' ) . replace ( / [\u030D\u0358] / g , '\u0307' ) return len === 0 ? '' : '<h-zhuyin length="' + len + '" diao="' + diao + '"><h-yin>' + yin + '</h-yin><h-diao>' + diao + '</h-diao></h-zhuyin>' }
Create a Zhuyin-form HTML string
Create a Zhuyin - form HTML string