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
" \
<< 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}#{map[border]}>"
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("