Skip to content
This repository has been archived by the owner on Apr 6, 2018. It is now read-only.

Add support for non us-ascii characters in presentations #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/keydown/tasks/slides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def slides(file)

say "Creating Keydown presentation from #{file}", :yellow

slide_deck = SlideDeck.new(File.new(file).read)
slide_deck = SlideDeck.new(File.new(file, 'rb').read)
backgrounds = slide_deck.slides.collect do |slide|
slide.background_image unless slide.background_image.empty?
end.compact
Expand All @@ -41,4 +41,4 @@ def slides(file)
end
end
end
end
end
13 changes: 13 additions & 0 deletions spec/fixtures/with_non_usascii_chars.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Kermit the Frog Says...

!SLIDE

# Esta presentación

!SLIDE foo

# es traída a ustedes por

!SLIDE foo bar

# un ñandú
20 changes: 19 additions & 1 deletion spec/tasks/slides_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,22 @@
@doc.css('link[@href="css/keydown.css"]').length.should == 1
end
end
end

describe "for a presentation that has non US-ASCII characters" do
before(:each) do
capture_output do
Dir.chdir project_dir do
file_name = "with_non_usascii_chars.md"
system "cp #{Keydown::Tasks.source_root}/spec/fixtures/#{file_name} #{tmp_dir}/test/#{file_name}"

@thor.invoke Keydown::Tasks, ["slides", file_name]

@file = File.new('with_non_usascii_chars.html')
@doc = Nokogiri(@file)
end
end
end

it_should_behave_like "generating a presentation file"
end
end