Method: ConverterBase#convert_horizontal_ellipsis
- Defined in:
- lib/converterbase.rb
#convert_horizontal_ellipsis(data) ⇒ Object
中黒(・)や句読点を並べて三点リーダーもどきにしているのを三点リーダーに変換
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 |
# File 'lib/converterbase.rb', line 818 def convert_horizontal_ellipsis(data) return if !@setting.enable_convert_horizontal_ellipsis || @text_type == "subtitle" %w(・ 。 、).each do |char| data.gsub!(/#{char}{3,}/) do |match| pre_char, post_char = $`[-1], $'[0] if pre_char == "―" || post_char == "―" match else "…" * ((match.length / 3.0 / 2).ceil * 2) end end end data.gsub!("。。", "。") data.gsub!("、、", "、") end |