Method: HTML#ruby_to_aozora
- Defined in:
- lib/html.rb
#ruby_to_aozora(text = @string) ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/html.rb', line 74 def ruby_to_aozora(text = @string) text.tr("《》", "≪≫") .gsub(/<ruby>(.+?)<\/ruby>/i) do splited_ruby = $1.split(/<rt>/i) next delete_tag(splited_ruby[0]) unless splited_ruby[1] ruby_base = delete_tag(splited_ruby[0].split(/<rp>/i)[0]) ruby_text = delete_tag(splited_ruby[1].split(/<rp>/i)[0]) "|#{ruby_base}《#{ruby_text}》" end end |