modsulator 0.0.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/modsulator/modsulator_template.xlsx +0 -0
  3. data/lib/modsulator/modsulator_template.xml +1086 -51
  4. data/lib/modsulator.rb +3 -6
  5. data/spec/features/normalizer_unit_spec.rb +5 -4
  6. data/spec/fixtures/Fitch_Chavez.xlsx +0 -0
  7. data/spec/fixtures/Fitch_Chavez.xml +210 -210
  8. data/spec/fixtures/Fitch_King.xml +193 -193
  9. data/spec/fixtures/Heckrotte_ChartsOfCoastSurvey.xlsx +0 -0
  10. data/spec/fixtures/Heckrotte_ChartsOfCoastSurvey.xml +1835 -0
  11. data/spec/fixtures/M1463_AV_manifest.xml +43 -43
  12. data/spec/fixtures/Matter_manifest.csv +295 -295
  13. data/spec/fixtures/Matter_manifest.xml +359 -359
  14. data/spec/fixtures/PosadaSpreadsheet.xml +1 -1
  15. data/spec/fixtures/SC1049_metadata.xlsx +0 -0
  16. data/spec/fixtures/SC1049_metadata.xml +18644 -0
  17. data/spec/fixtures/ars0056_manifest.csv +261 -1
  18. data/spec/fixtures/ars0056_manifest.xml +18 -18
  19. data/spec/fixtures/crowdsourcing_bridget_1.xlsx +0 -0
  20. data/spec/fixtures/crowdsourcing_bridget_1.xml +1 -1
  21. data/spec/fixtures/crowdsourcing_bridget_2.xlsx +0 -0
  22. data/spec/fixtures/crowdsourcing_bridget_2.xml +1 -1
  23. data/spec/fixtures/manifest_v0174.csv +34 -34
  24. data/spec/fixtures/manifest_v0174.xml +32 -32
  25. data/spec/fixtures/roman_coins_mods.xlsx +0 -0
  26. data/spec/fixtures/roman_coins_mods.xml +7634 -0
  27. data/spec/fixtures/test:002.xml +1 -1
  28. data/spec/integration_tests/integration_spec.rb +4 -2
  29. metadata +14 -10
  30. data/spec/fixtures/SC0144_template.xlsx +0 -0
  31. data/spec/fixtures/SC0453_template.xlsx +0 -0
  32. data/spec/fixtures/roman_coins_mods_manifest.csv +0 -176
  33. data/spec/fixtures/roman_coins_mods_manifest.xml +0 -3025
data/lib/modsulator.rb CHANGED
@@ -106,12 +106,9 @@ class Modsulator
106
106
  # XML escape all of the entries in the manifest row so they won't break the XML. This will turn any '<' into &#lt;
107
107
  # and international characters into their corresponding code point etc.
108
108
  manifest_row.each do |k, v|
109
- if(v)
110
- if(v.instance_of?(String) && has_whitespace_markup?(v))
111
- v = transform_whitespace_markup(v)
112
- end
113
- manifest_row[k] = Nokogiri::XML::Text.new(v.to_s, Nokogiri::XML('')).to_s
114
- end
109
+ next unless v
110
+ v = transform_whitespace_markup(v) if v.instance_of?(String) && has_whitespace_markup?(v)
111
+ manifest_row[k] = Nokogiri::XML::Text.new(v.to_s, Nokogiri::XML('')).to_s
115
112
  end
116
113
 
117
114
 
@@ -58,7 +58,8 @@ problem
58
58
 
59
59
  describe "trim_text" do
60
60
  it "raises an exception given a nil input" do
61
- expect { @normalizer.trim_text(nil) }.to raise_error
61
+ # binding.pry
62
+ expect { @normalizer.trim_text(nil) }.to raise_error(NoMethodError)
62
63
  end
63
64
 
64
65
  it "returns the tree unchanged, given a tree that contains no text" do
@@ -78,7 +79,7 @@ problem
78
79
 
79
80
  describe "remove_empty_attributes" do
80
81
  it "raises an error given a null argument" do
81
- expect { @normalizer.remove_empty_attributes(nil) }.to raise_error
82
+ expect { @normalizer.remove_empty_attributes(nil) }.to raise_error(NoMethodError)
82
83
  end
83
84
 
84
85
  it "removes all empty attributes for a single node" do
@@ -98,7 +99,7 @@ problem
98
99
 
99
100
  describe "remove_empty_nodes" do
100
101
  it "raises an exception given a null input" do
101
- expect { @normalizer.remove_empty_nodes(nil) }.to raise_error
102
+ expect { @normalizer.remove_empty_nodes(nil) }.to raise_error(NoMethodError)
102
103
  end
103
104
 
104
105
  it "removes all nodes, given a subtree that contains only empty nodes" do
@@ -146,7 +147,7 @@ problem
146
147
  end
147
148
 
148
149
  it "raises an exception given a null input" do
149
- expect { @normalizer.clean_linefeeds(nil) }.to raise_error
150
+ expect { @normalizer.clean_linefeeds(nil) }.to raise_error(NoMethodError)
150
151
  end
151
152
  end
152
153
  end
Binary file