jarrett-quarto 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.5.1
@@ -14,7 +14,7 @@ module Quarto
14
14
  #
15
15
  # If you do not specify a default class,
16
16
  # <tt>HtmlTransformer</tt> will be used.
17
- def transform_xml(element, transformer_class = Quarto::HtmlTransformer)
17
+ def transform_xml(element, transformer_class = Quarto::HtmlTransformer, raise_on_unrecognized_element = true)
18
18
  raise ArgumentError, "Expected REXML::Element but got #{element.inspect}" unless element.is_a?(REXML::Element)
19
19
  class_error = "Expected subclass of Tranformer but got #{transformer_class.inspect}"
20
20
  raise ArgumentError, class_error unless transformer_class.is_a?(Class)
@@ -23,7 +23,7 @@ module Quarto
23
23
  klass = klass.superclass
24
24
  end
25
25
  raise ArgumentError, class_error unless Quarto::Transformer == klass
26
- transformer_class.new.transform(element)
26
+ transformer_class.new.transform(element, raise_on_unrecognized_element)
27
27
  end
28
28
  end
29
29
  end
data/quarto.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{quarto}
5
- s.version = "1.5.0"
5
+ s.version = "1.5.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jarrett Colby"]
9
- s.date = %q{2009-06-15}
9
+ s.date = %q{2009-06-18}
10
10
  s.default_executable = %q{quarto}
11
11
  s.description = %q{Quarto is a Ruby framework for generating collections of documents from XML. It steps in where XSLT just won't cut it. Potential applications include web sites and e-books. It's built on top of ERB and REXML.}
12
12
  s.email = %q{jarrett@uchicago.edu}
@@ -5,13 +5,19 @@ describe Quarto::TransformationHelper do
5
5
 
6
6
  context '#tranform_xml' do
7
7
  before :each do
8
- @html = REXML::Document.new(%Q(
8
+ @html = REXML::Document.new(%q(
9
9
  <div>
10
10
  <p>Foo</p>
11
11
  <p><a href="http://example.com">Bar</a></p>
12
12
  <p>Baz&mdash;Baz</p>
13
13
  </div>
14
14
  ))
15
+ @bad_html = REXML::Document.new(%q(
16
+ <div>
17
+ <p>Foo</p>
18
+ <bar>Baz</bar>
19
+ </div>
20
+ ))
15
21
  end
16
22
 
17
23
  it 'should return a string' do
@@ -24,6 +30,14 @@ describe Quarto::TransformationHelper do
24
30
  lambda { transform_xml('foo') }.should raise_error(ArgumentError, 'Expected REXML::Element but got "foo"')
25
31
  end
26
32
 
33
+ it 'should raise on an unrecognized element by default' do
34
+ lambda { transform_xml(@bad_html) }.should raise_error(Quarto::UnrecognizedElementError)
35
+ end
36
+
37
+ it 'should not raise on an unrecognized element if raise_on_unrecognized_element is false' do
38
+ transform_xml(@bad_html, Quarto::HtmlTransformer, false)
39
+ end
40
+
27
41
  context 'without transformer_class given' do
28
42
  it 'should use HtmlTransformer' do
29
43
  t = Quarto::HtmlTransformer.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jarrett-quarto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrett Colby
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-15 00:00:00 -07:00
12
+ date: 2009-06-18 00:00:00 -07:00
13
13
  default_executable: quarto
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency