diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb index 180bd80..98050ee 100644 --- a/lib/org-ruby/html_output_buffer.rb +++ b/lib/org-ruby/html_output_buffer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Orgmode class HtmlOutputBuffer < OutputBuffer @@ -191,7 +193,7 @@ def flush! @output << inline_formatting(@buffer) end end - @buffer = "" + @buffer = +"" end def add_line_attributes headline @@ -214,7 +216,7 @@ def output_footnotes! @output << "\n
\n

Footnotes:

\n
\n" @footnotes.each do |name, (defi, content)| - @buffer = defi + @buffer = +defi @output << "
#{name}" \ << "

" \ << inline_formatting(@buffer) \ @@ -424,7 +426,7 @@ def strip_code_block! # # => "Usage: foo "bar" <baz>" private def escapeHTML(string) - string.gsub(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__) + +(string.gsub(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__)) end end # class HtmlOutputBuffer end # module Orgmode diff --git a/lib/org-ruby/markdown_output_buffer.rb b/lib/org-ruby/markdown_output_buffer.rb index b29d91f..7e8e0bd 100644 --- a/lib/org-ruby/markdown_output_buffer.rb +++ b/lib/org-ruby/markdown_output_buffer.rb @@ -105,7 +105,7 @@ def flush! end @output << inline_formatting(@buffer) << "\n" end - @buffer = "" + @buffer = +"" end def add_line_attributes headline diff --git a/lib/org-ruby/output_buffer.rb b/lib/org-ruby/output_buffer.rb index 90a0aae..86238e7 100644 --- a/lib/org-ruby/output_buffer.rb +++ b/lib/org-ruby/output_buffer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'logger' module Orgmode @@ -20,7 +22,7 @@ def initialize(output) # This is the accumulation buffer. It's a holding pen so # consecutive lines of the right type can get stuck together # without intervening newlines. - @buffer = "" + @buffer = +"" # This stack is used to do proper outline numbering of # headlines. diff --git a/lib/org-ruby/parser.rb b/lib/org-ruby/parser.rb index a57fd9e..6493b69 100644 --- a/lib/org-ruby/parser.rb +++ b/lib/org-ruby/parser.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rubypants' module Orgmode @@ -301,7 +303,7 @@ def self.load(fname, opts = {}) # Saves the loaded orgmode file as a textile file. def to_textile - output = "" + output = +"" output_buffer = TextileOutputBuffer.new(output) translate(@header_lines, output_buffer) @@ -317,7 +319,7 @@ def to_markdown export_options = { :markup_file => @parser_options[:markup_file] } - output = "" + output = +"" output_buffer = MarkdownOutputBuffer.new(output, export_options) translate(@header_lines, output_buffer) @@ -349,7 +351,7 @@ def to_html :markup_file => @parser_options[:markup_file] } export_options[:skip_tables] = true if not export_tables? - output = "" + output = +"" output_buffer = HtmlOutputBuffer.new(output, export_options) if @in_buffer_settings["TITLE"] diff --git a/lib/org-ruby/textile_output_buffer.rb b/lib/org-ruby/textile_output_buffer.rb index 58d3f22..42fa76f 100644 --- a/lib/org-ruby/textile_output_buffer.rb +++ b/lib/org-ruby/textile_output_buffer.rb @@ -144,7 +144,7 @@ def flush! end @output << inline_formatting(@buffer) << "\n" end - @buffer = "" + @buffer = +"" end def add_line_attributes headline diff --git a/spec/regexp_helper_spec.rb b/spec/regexp_helper_spec.rb index 694405a..0fdf863 100644 --- a/spec/regexp_helper_spec.rb +++ b/spec/regexp_helper_spec.rb @@ -40,7 +40,7 @@ "/" => "i", "~" => "code" } - n = e.rewrite_emphasis("This string contains *bold*, /italic/, and ~verbatim~ text.") do |border, str| + n = e.rewrite_emphasis(+"This string contains *bold*, /italic/, and ~verbatim~ text.") do |border, str| "<#{map[border]}>#{str}" end n = e.restore_code_snippets n @@ -50,15 +50,15 @@ it "should allow link rewriting" do e = Orgmode::RegexpHelper.new - str = e.rewrite_links("[[http://www.bing.com]]") do |link,text| + str = e.rewrite_links(+"[[http://www.bing.com]]") do |link,text| text ||= link "\"#{text}\":#{link}" end expect(str).to eql("\"http://www.bing.com\":http://www.bing.com") - str = e.rewrite_links("") do |link| + str = e.rewrite_links(+"") do |link| "\"#{link}\":#{link}" end - expect(str).to eql("\"http://www.google.com\":http://www.google.com") + expect(str).to eql(+"\"http://www.google.com\":http://www.google.com") end it "should allow quotes within code markup" do @@ -66,7 +66,7 @@ map = { "~" => "code" } - n = e.rewrite_emphasis('This string contains a quote using code markup: ~"~') do |border, str| + n = e.rewrite_emphasis(+'This string contains a quote using code markup: ~"~') do |border, str| "<#{map[border]}>#{str}" end n = e.restore_code_snippets n diff --git a/spec/textile_output_buffer_spec.rb b/spec/textile_output_buffer_spec.rb index fe21ee6..7e32fb1 100644 --- a/spec/textile_output_buffer_spec.rb +++ b/spec/textile_output_buffer_spec.rb @@ -2,20 +2,20 @@ describe Orgmode::TextileOutputBuffer do it "should substitute / with _" do - expect(Orgmode::TextileOutputBuffer.new("").inline_formatting("/italic/")).to eql("_italic_") + expect(Orgmode::TextileOutputBuffer.new("").inline_formatting(+"/italic/")).to eql("_italic_") end it "should convert simple links" do - expect(Orgmode::TextileOutputBuffer.new("").inline_formatting("[[http://www.google.com]]")).to \ + expect(Orgmode::TextileOutputBuffer.new("").inline_formatting(+"[[http://www.google.com]]")).to \ eql("\"http://www.google.com\":http://www.google.com") end it "should convert links with text" do - expect(Orgmode::TextileOutputBuffer.new("").inline_formatting("[[http://www.google.com][Google]]")).to \ + expect(Orgmode::TextileOutputBuffer.new("").inline_formatting(+"[[http://www.google.com][Google]]")).to \ eql("\"Google\":http://www.google.com") end it "should convert spaces in urls" do - expect(Orgmode::TextileOutputBuffer.new("").inline_formatting("[[my url]]")).to eql("\"my url\":my%20url") + expect(Orgmode::TextileOutputBuffer.new("").inline_fgit ormatting(+"[[my url]]")).to eql("\"my url\":my%20url") end end