pink_shirt 0.0.3 → 0.0.4

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/changelog CHANGED
@@ -1,7 +1,9 @@
1
+ 0.0.4
2
+ - doesn't die on unrecognised tags
1
3
  0.0.3
2
4
  - was choking on tbody
3
5
  - added allowance for tbody and thead
4
- 0.0.2
6
+ 0.0.2
5
7
  whitespace and documentation formatting
6
- 0.0.1
8
+ 0.0.1
7
9
  intial release
@@ -1,7 +1,7 @@
1
1
  class PinkShirt
2
2
  # SAX inherits from nokogiri's SAX::Document class
3
3
  # I'd recommend you visit nokogiri's documentation to learn more.
4
- #
4
+ #
5
5
  # here's the gist.
6
6
  # each time the parser encounter's an opening tag it fires an event 'start_element'
7
7
  # each time the parser encounters a closing tag it fires an even 'end_element'
@@ -11,8 +11,8 @@ class PinkShirt
11
11
  # and a call to #end_html when </html> is reached, same for all the other tags
12
12
  #
13
13
  # each of the processors are classes that are responsible for a specific subset of tags
14
-
15
-
14
+
15
+
16
16
  class SAX < Nokogiri::XML::SAX::Document
17
17
  def initialize(fail_on_unknown=false)
18
18
  @fail_on_unknown = fail_on_unknown
@@ -52,12 +52,13 @@ class PinkShirt
52
52
 
53
53
  def start_element name, attrs = []
54
54
  attrs = Hash[attrs]
55
- get_processor(name).send("start_#{name}", attrs)
55
+ processor = get_processor(name)
56
+ processor.send("start_#{name}", attrs) if processor
56
57
  end
57
58
 
58
59
  def end_element name
59
- get_processor(name).send("end_#{name}")
60
-
60
+ processor = get_processor(name)
61
+ get_processor(name).send("end_#{name}") if processor
61
62
  end
62
63
 
63
64
  def characters(string)
@@ -1,3 +1,3 @@
1
1
  class PinkShirt
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,8 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe 'Random and or namespaced tags' do
4
+ it 'should not choke and die' do
5
+ input = "<notextile>whatever</notextile>"
6
+ Proc.new {PinkShirt.new(input).to_textile}.should_not raise_error
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pink_shirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-18 00:00:00.000000000 Z
12
+ date: 2012-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: RedCloth
16
- requirement: &70163891102960 !ruby/object:Gem::Requirement
16
+ requirement: &70173956902260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70163891102960
24
+ version_requirements: *70173956902260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70163891102220 !ruby/object:Gem::Requirement
27
+ requirement: &70173956901080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70163891102220
35
+ version_requirements: *70173956901080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70163891101080 !ruby/object:Gem::Requirement
38
+ requirement: &70173956899000 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70163891101080
46
+ version_requirements: *70173956899000
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &70163891100520 !ruby/object:Gem::Requirement
49
+ requirement: &70173956897640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70163891100520
57
+ version_requirements: *70173956897640
58
58
  description: Converts Html to Textile, or as some say 'html2textile', it's built on
59
59
  nokogiri
60
60
  email:
@@ -102,6 +102,7 @@ files:
102
102
  - spec/textile-spec/paragraph_text.yaml
103
103
  - spec/textile-spec/phrase_modifiers.yaml
104
104
  - spec/textile_spec.rb
105
+ - spec/unrecognised_tags_spec.rb
105
106
  homepage: ''
106
107
  licenses: []
107
108
  post_install_message:
@@ -141,4 +142,5 @@ test_files:
141
142
  - spec/textile-spec/paragraph_text.yaml
142
143
  - spec/textile-spec/phrase_modifiers.yaml
143
144
  - spec/textile_spec.rb
145
+ - spec/unrecognised_tags_spec.rb
144
146
  has_rdoc: