-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#428 Improve support for reading UTF-16 encoded source files
- Loading branch information
Showing
3 changed files
with
51 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ | |
== First Section | ||
#{name}::#{name}.txt[#{format}] | ||
eos | ||
eos | ||
|
||
d = load_asciidoc doc, :safe => 'server', :attributes => {'backend' => 'html5'} | ||
expect(d).to_not be_nil | ||
|
@@ -217,6 +217,35 @@ | |
expect(File.exist?("test2/foobaz.#{formats[0]}")).to be true | ||
expect(File.exist?("#{name}.#{formats[0]}")).to be false | ||
end | ||
|
||
{ | ||
::Encoding::UTF_16LE => String.new("\xff\xfe", :encoding => Encoding::ASCII_8BIT), | ||
::Encoding::UTF_16BE => String.new("\xfe\xff", :encoding => Encoding::ASCII_8BIT), | ||
::Encoding::UTF_8 => String.new("\xef\xbb\xbf", :encoding => Encoding::ASCII_8BIT) | ||
}.each_pair do |encoding, bom| | ||
it "should support #{encoding.name} encoded source files" do | ||
File.open("#{name}.txt", 'wb') do |f| | ||
f.write bom | ||
f.write code.encode(encoding).b | ||
end | ||
|
||
doc = <<-eos | ||
= Hello, #{name}! | ||
Doc Writer <[email protected]> | ||
== First Section | ||
.This is a diagram | ||
#{name}::#{name}.txt[] | ||
eos | ||
|
||
d = load_asciidoc doc | ||
expect(d).to_not be_nil | ||
|
||
b = d.find { |bl| bl.context == :image } | ||
expect(b).to_not be_nil | ||
end | ||
end | ||
end | ||
|
||
RSpec.shared_examples "inline_macro" do |name, code, formats| | ||
|
@@ -269,7 +298,7 @@ | |
== First Section | ||
#{name}::#{name}.txt[#{format}] | ||
eos | ||
eos | ||
|
||
d = load_asciidoc doc, :safe => 'server', :attributes => {'backend' => 'html5'} | ||
expect(d).to_not be_nil | ||
|
@@ -473,7 +502,7 @@ | |
== First Section | ||
#{name}::#{name}.txt[#{format}] | ||
eos | ||
eos | ||
|
||
d = load_asciidoc doc, :safe => 'server', :attributes => {'backend' => 'html5'} | ||
expect(d).to_not be_nil | ||
|