Skip to content
Browse files

fix the newline issue with double quotes \n, delete ItemProcess requi…

…re and includes in main sm_to_anki.rb file
  • Loading branch information...
1 parent 53a2901 commit 084c6026b9b2aae5d6383d9c0a164f940eb2de8e @yangchenyun committed Jun 12, 2012
Showing with 2 additions and 5 deletions.
  1. +0 −3 lib/sm_to_anki.rb
  2. +1 −1 lib/sm_to_anki/item.rb
  3. +1 −1 spec/item_spec.rb
View
3 lib/sm_to_anki.rb
@@ -1,14 +1,11 @@
# encoding: utf-8
require "sm_to_anki/version"
-require "sm_to_anki/item_process"
require 'sm_to_anki/item'
require 'nokogiri'
require 'FileUtils'
module SmToAnki
class CourseProcessor
- include SmToAnki::ItemProcessor
-
# process_dir contains current working directory
# course_doc is the hold an Nokogiri instance of course.xml
# course_info holds an Ruby hash containing the course information
View
2 lib/sm_to_anki/item.rb
@@ -103,7 +103,7 @@ def decode_unicode(string)
coder = HTMLEntities.new
string = coder.decode(string)
string = coder.decode(string)
- string.gsub!("\\n", '<br></br>')
+ string.gsub!("\n", '<br></br>')
string
end
end
View
2 spec/item_spec.rb
@@ -48,7 +48,7 @@
item = SmToAnki::Item.new("newline", "#{@working_dir}/field_processing/", 'fake_course')
result = item.process.split('|')
puts "#{result}"
- assert !result[2].include?('\n')
+ assert !result[2].include?("\n")
assert result[2].include?('<br></br>')
end

0 comments on commit 084c602

Please sign in to comment.
Something went wrong with that request. Please try again.