Method: ConverterBase#narou_ruby

Defined in:
lib/converterbase.rb

#narou_ruby(data) ⇒ Object

小説家になろうのルビ対策



848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
# File 'lib/converterbase.rb', line 848

def narou_ruby(data)
  if @text_type != "subtitle" && @text_type != "chapter"
    # 《》なルビの対処
    data.gsub!(/(.+?)≪([^≪]+?)≫/) do |match|
      to_ruby(match, $1, $2, ["", ""])
    end
    if @data_type == "text"
      # ()なルビの対処
      data.gsub!(/(.+?)(#{AUTO_RUBY_CHARACTERS}/) do |match|
        to_ruby(match, $1, $2, ["", ""])
      end
    end
  end
  data.replace(replace_tatesen(data))
  data.gsub!("[#ルビ用縦線]", "")
end