Method: ConverterBase#before

Defined in:
lib/converterbase.rb

#before(io, text_type) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/converterbase.rb', line 23

def before(io, text_type)
  data = io.string
  convert_page_break(data) if @text_type == "body" || @text_type == "textfile"
  if @text_type != "story" && @setting.enable_pack_blank_line
    data.gsub!("\n\n", "\n")
    data.gsub!(/(^\n){3}/m, "\n\n")   # 改行のみの行3つを2つに削減
  end
  io
end