texttube_baby 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 418cb4a5268b6c0f2e97adadcd5f98ead13fb5ab
4
- data.tar.gz: f767767cd2ab6c8800717fb87af479bc3db01f2c
3
+ metadata.gz: 3683d2f419a0d6dcf000e7529ea1ccc71c05c333
4
+ data.tar.gz: bf7786e8ca629ac8198c0e3aa6b2abcea5d2b49f
5
5
  SHA512:
6
- metadata.gz: 4abc064a958b26c54291288ac0c89d41ff7ebabee88ce5abb0ff7ec32fb60d74f0a7742683fead1b078f2f402016a873e9d7443fc482c998d2cb768cbf2ddc24
7
- data.tar.gz: b2aa89e936d22a0153e31770777ad88024925fdb29fe473703e219b3ab2ae951f5f821125986574f74c171770e030f966a7d09951d9a9104d868b7f1e6a64b82
6
+ metadata.gz: d49031f13f772f2aff66c3096ca1bd71999a6cd84005d67233d055d6cff920c0446f5c27810af5954d553b740ecd7e7e6a07e430b1dbdab9d4d084be5042a84c
7
+ data.tar.gz: 94ae20332a207a82aa0e4cc957cc57ebb41003a2d4d2a2fea42c2b8040d1fbc7b3d0f8bb5e86cd43da018748791b20218964063ec8cbe2027945c123fc4e225f
data/CHANGES.md ADDED
@@ -0,0 +1,7 @@
1
+ ## CH CH CH CH CHANGES! ##
2
+
3
+ ### Friday the 17th of October 2014, v1.0.0 ###
4
+
5
+ * All specs passing, library now separated from TextTube.
6
+
7
+ ----
data/Gemfile CHANGED
@@ -3,7 +3,13 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in TextTubeBaby.gemspec
4
4
  gemspec
5
5
 
6
+ group :development do
7
+ gem "pry"
8
+ end
9
+
6
10
  group :test do
7
11
  gem "rspec"
8
12
  gem "simplecov"
13
+ gem "rspec-its"
14
+ gem "rdiscount"
9
15
  end
@@ -6,63 +6,65 @@ module TextTube
6
6
  require 'coderay'
7
7
  require "texttube/filterable"
8
8
 
9
- # a filter for Coderay
10
- module Coderay
11
- extend Filterable
9
+ module Baby
12
10
 
13
- filter_with :coderay do |text|
14
- TextTube::Coderay.run text
15
- end
11
+ # a filter for Coderay
12
+ module Coderay
13
+ extend Filterable
16
14
 
15
+ filter_with :coderay do |text|
16
+ run text
17
+ end
17
18
 
18
- # @param [String] content
19
- # @param [Hash] options
20
- # @return [String]
21
- def self.run(content, options={})
22
- options = {lang: :ruby } if options.blank?
23
- doc = Nokogiri::HTML::fragment(content)
24
19
 
25
- code_blocks = doc.xpath("pre/code").map do |code_block|
26
- #un-escape as Coderay will escape it again
27
- inner_html = code_block.inner_html
28
-
29
- # following the convention of Rack::Codehighlighter
30
- if inner_html.start_with?("::::")
31
- lines = inner_html.split("\n")
32
- options[:lang] = lines.shift.match(%r{::::(\w+)})[1].to_sym
33
- inner_html = lines.join("\n")
34
- end
20
+ # @param [String] content
21
+ # @param [Hash] options
22
+ # @return [String]
23
+ def self.run(content, options={})
24
+ options = {lang: :ruby } if options.blank?
25
+ doc = Nokogiri::HTML::fragment(content)
35
26
 
36
- if (options[:lang] == :skip) || (! options.has_key? :lang )
37
- code_block.inner_html = inner_html
38
- else
39
- code = Coderay.codify(Coderay.html_unescape(inner_html), options[:lang])
40
- code_block.inner_html = code
41
- code_block["class"] = "CodeRay"
42
- end
43
- end#block
27
+ code_blocks = doc.xpath("pre/code").map do |code_block|
28
+ #un-escape as Coderay will escape it again
29
+ inner_html = code_block.inner_html
30
+
31
+ # following the convention of Rack::Codehighlighter
32
+ if inner_html.start_with?("::::")
33
+ lines = inner_html.split("\n")
34
+ options[:lang] = lines.shift.match(%r{::::(\w+)})[1].to_sym
35
+ inner_html = lines.join("\n")
36
+ end
44
37
 
45
- doc.to_s
46
- end#def
38
+ if (options[:lang] == :skip) || (! options.has_key? :lang )
39
+ code_block.inner_html = inner_html
40
+ else
41
+ code = Coderay.codify(Coderay.html_unescape(inner_html), options[:lang])
42
+ code_block.inner_html = code
43
+ code_block["class"] = "CodeRay"
44
+ end
45
+ end#block
47
46
 
48
- # @private
49
- # Unescape the HTML as the Coderay scanner won't work otherwise.
50
- def self.html_unescape(a_string)
51
- a_string.gsub('&amp;', '&').gsub('&lt;', '<').gsub('&gt;',
52
- '>').gsub('&quot;', '"')
53
- end#def
47
+ doc.to_s
48
+ end#def
54
49
 
55
- # Run the Coderay scanner.
56
- # @private
57
- # @param [String] str
58
- # @param [String] lang
59
- # @example
60
- # self.class.codify "x = 2", "ruby"
61
- def self.codify(str, lang)
62
- CodeRay.scan(str, lang).html
63
- end#def
50
+ # @private
51
+ # Unescape the HTML as the Coderay scanner won't work otherwise.
52
+ def self.html_unescape(a_string)
53
+ a_string.gsub('&amp;', '&').gsub('&lt;', '<').gsub('&gt;',
54
+ '>').gsub('&quot;', '"')
55
+ end#def
64
56
 
65
- end#class
57
+ # Run the Coderay scanner.
58
+ # @private
59
+ # @param [String] str
60
+ # @param [String] lang
61
+ # @example
62
+ # self.class.codify "x = 2", "ruby"
63
+ def self.codify(str, lang)
64
+ ::CodeRay.scan(str, lang).html
65
+ end#def
66
66
 
67
+ end#class
68
+ end
67
69
 
68
70
  end#module
@@ -3,122 +3,126 @@ require "texttube/filterable"
3
3
 
4
4
  module TextTube
5
5
 
6
- # Embed video via [embed_SIZE[url|description]]
7
- module EmbeddingVideo
8
- extend TextTube::Filterable
9
-
10
- filter_with :embeddingvideo do |text|
11
- run text
12
- end
13
-
14
- # List of available sites.
15
- SITES = {
16
- # "video.google".to_sym => ['http://www.video.google.com/',->(w,h,url){ %Q!! }],
17
- # :brightcove => ['http://www.brightcove.com/',->(w,h,url){ %Q!! }],
18
- # :photobucket => ['http://www.photobucket.com/',->(w,h,url){ %Q!! }],
19
- :youtube => {
20
- name: 'https://www.youtube.com/',
21
- html: ->(w,h,url){ %Q!<iframe title="YouTube video player" class="youtube-player" type="text/html" width="#{w}" height="#{h}" src="#{url}" frameborder="0"></iframe>!.strip},
22
- url_morph: ->(orig){
23
- if orig.match %r{youtube\.com}
24
- orig.sub( %r{watch\?v=}, 'embed/')
25
- elsif orig.match %r{youtu\.be}
26
- orig.sub( %r{youtu\.be}, "www.youtube.com/embed" )
27
- else
28
- fail ArgumentError, "That is not a youtube link"
29
- end
30
- }
31
- },
32
- # :dailymotion => ['http://dailymotion.com/',->(w,h,url){ %Q!! }],
33
- # :ifilm => ['http://ifilm.com/',->(w,h,url){ %Q!! }],
34
- # :break => ['http://break.com/',->(w,h,url){ %Q!! }],
35
- # :blip => ['http://blip.tv/',->(w,h,url){ %Q!! }],
36
- # :grindtv => ['http://www.grindtv.com/',->(w,h,url){ %Q!! }],
37
- # :metacafe => ['http://metacafe.com/',->(w,h,url){ %Q!! }],
38
- # :myspace => ['http://vids.myspace.com/',->(w,h,url){ %Q!! }],
39
- # :vimeo => ['http://vimeo.com/',->(w,h,url){ %Q!! }],
40
- # :buzznet => ['http://buzznet.com/',->(w,h,url){ %Q!! }],
41
- # :liveleak => ['http://www.liveleak.com/',->(w,h,url){ %Q!! }],
42
- # :stupidvideos => ['http://stupidvideos.com/',->(w,h,url){ %Q!! }],
43
- # :flixya => ['http://www.flixya.com/',->(w,h,url){ %Q!! }],
44
- # :gofish => ['http://gofish.com/',->(w,h,url){ %Q!! }],
45
- # :kewego => ['http://kewego.com/',->(w,h,url){ %Q!! }],
46
- # :lulu => ['http://lulu.tv/',->(w,h,url){ %Q!! }],
47
- # :pandora => ['http://pandora.tv/',->(w,h,url){ %Q!! }],
48
- # :viddler => ['http://www.viddler.com/',->(w,h,url){ %Q!! }],
49
- # :myheavy => ['http://myheavy.com/',->(w,h,url){ %Q!! }],
50
- # :putfile => ['http://putfile.com/',->(w,h,url){ %Q!! }],
51
- # :stupidvideos => ['http://stupidvideos.com/',->(w,h,url){ %Q!! }],
52
- # :vmix => ['http://vmix.com/',->(w,h,url){ %Q!! }],
53
- # :zippyvideos => ['http://zippyvideos.com/',->(w,h,url){ %Q!! }],
54
- # :castpost => ['http://castpost.com/',->(w,h,url){ %Q!! }],
55
- # :dotv => ['http://dotv.com/',->(w,h,url){ %Q!! }],
56
- # :famster => ['http://famster.com/',->(w,h,url){ %Q!! }],
57
- # :gawkk => ['http://gawkk.com/',->(w,h,url){ %Q!! }],
58
- # :tubetorial => ['http://tubetorial.com/',->(w,h,url){ %Q!! }],
59
- # :MeraVideo => ['http://MeraVideo.com/',->(w,h,url){ %Q!! }],
60
- # :Porkolt => ['http://Porkolt.com/',->(w,h,url){ %Q!! }],
61
- # :VideoWebTown => ['http://VideoWebTown.com/',->(w,h,url){ %Q!! }],
62
- # :Vidmax => ['http://Vidmax.com/',->(w,h,url){ %Q!! }],
63
- # :clipmoon => ['http://www.clipmoon.com/',->(w,h,url){ %Q!! }],
64
- # :motorsportmad => ['http://motorsportmad.com/',->(w,h,url){ %Q!! }],
65
- # :thatshow => ['http://www.thatshow.com/',->(w,h,url){ %Q!! }],
66
- # :clipchef => ['http://clipchef.com/',->(w,h,url){ %Q!! }],
67
- }
68
-
69
- # Some standard player sizes.
70
- SIZES = {
71
- small: {w: 560, h: 345},
72
- medium: {w: 640, h:390},
73
- large: {w: 853, h:510},
74
- largest: {w: 1280, h:750},
75
- }
76
-
77
-
78
-
79
- # r_url = %r{
80
- # http(?:s)?\:// #http https ://
81
- # (?:(?:www|vids)\.)? # www. vids.
82
- # (.+?) # domain name (hopefully)
83
- # \.(?:com|tv) # .com .tv
84
- # /? # optional trailing slash
85
- # }x
86
-
87
- # Pattern for deconstructing [video_SIZE[url|description]]
88
- R_link = / # [video_SIZE[url|description]]
89
- \[video # opening square brackets
90
- (?:\_(?<size>[a-z]+))? # player size (optional)
91
- \[
92
- (?<url>[^\|]+) # url
93
- \| # separator
94
- (?<desc>[^\[]+) # description
95
- \]\] # closing square brackets
96
- /x
97
-
98
-
99
- # @param [String] content
100
- # @param [Hash] options
101
- # @return [String]
102
- def self.run(content, options={})
103
- options ||= {}
104
- content.gsub( R_link ) { |m|
6
+ module Baby
7
+
8
+ # Embed video via [embed_SIZE[url|description]]
9
+ module EmbeddingVideo
10
+ extend TextTube::Filterable
11
+
12
+ filter_with :embeddingvideo do |text|
13
+ run text
14
+ end
15
+
16
+ # List of available sites.
17
+ SITES = {
18
+ # "video.google".to_sym => ['http://www.video.google.com/',->(w,h,url){ %Q!! }],
19
+ # :brightcove => ['http://www.brightcove.com/',->(w,h,url){ %Q!! }],
20
+ # :photobucket => ['http://www.photobucket.com/',->(w,h,url){ %Q!! }],
21
+ :youtube => {
22
+ name: 'https://www.youtube.com/',
23
+ html: ->(w,h,url){ %Q!<iframe title="YouTube video player" class="youtube-player" type="text/html" width="#{w}" height="#{h}" src="#{url}" frameborder="0"></iframe>!.strip},
24
+ url_morph: ->(orig){
25
+ if orig.match %r{youtube\.com}
26
+ orig.sub( %r{watch\?v=}, 'embed/')
27
+ elsif orig.match %r{youtu\.be}
28
+ orig.sub( %r{youtu\.be}, "www.youtube.com/embed" )
29
+ else
30
+ fail ArgumentError, "That is not a youtube link"
31
+ end
32
+ }
33
+ },
34
+ # :dailymotion => ['http://dailymotion.com/',->(w,h,url){ %Q!! }],
35
+ # :ifilm => ['http://ifilm.com/',->(w,h,url){ %Q!! }],
36
+ # :break => ['http://break.com/',->(w,h,url){ %Q!! }],
37
+ # :blip => ['http://blip.tv/',->(w,h,url){ %Q!! }],
38
+ # :grindtv => ['http://www.grindtv.com/',->(w,h,url){ %Q!! }],
39
+ # :metacafe => ['http://metacafe.com/',->(w,h,url){ %Q!! }],
40
+ # :myspace => ['http://vids.myspace.com/',->(w,h,url){ %Q!! }],
41
+ # :vimeo => ['http://vimeo.com/',->(w,h,url){ %Q!! }],
42
+ # :buzznet => ['http://buzznet.com/',->(w,h,url){ %Q!! }],
43
+ # :liveleak => ['http://www.liveleak.com/',->(w,h,url){ %Q!! }],
44
+ # :stupidvideos => ['http://stupidvideos.com/',->(w,h,url){ %Q!! }],
45
+ # :flixya => ['http://www.flixya.com/',->(w,h,url){ %Q!! }],
46
+ # :gofish => ['http://gofish.com/',->(w,h,url){ %Q!! }],
47
+ # :kewego => ['http://kewego.com/',->(w,h,url){ %Q!! }],
48
+ # :lulu => ['http://lulu.tv/',->(w,h,url){ %Q!! }],
49
+ # :pandora => ['http://pandora.tv/',->(w,h,url){ %Q!! }],
50
+ # :viddler => ['http://www.viddler.com/',->(w,h,url){ %Q!! }],
51
+ # :myheavy => ['http://myheavy.com/',->(w,h,url){ %Q!! }],
52
+ # :putfile => ['http://putfile.com/',->(w,h,url){ %Q!! }],
53
+ # :stupidvideos => ['http://stupidvideos.com/',->(w,h,url){ %Q!! }],
54
+ # :vmix => ['http://vmix.com/',->(w,h,url){ %Q!! }],
55
+ # :zippyvideos => ['http://zippyvideos.com/',->(w,h,url){ %Q!! }],
56
+ # :castpost => ['http://castpost.com/',->(w,h,url){ %Q!! }],
57
+ # :dotv => ['http://dotv.com/',->(w,h,url){ %Q!! }],
58
+ # :famster => ['http://famster.com/',->(w,h,url){ %Q!! }],
59
+ # :gawkk => ['http://gawkk.com/',->(w,h,url){ %Q!! }],
60
+ # :tubetorial => ['http://tubetorial.com/',->(w,h,url){ %Q!! }],
61
+ # :MeraVideo => ['http://MeraVideo.com/',->(w,h,url){ %Q!! }],
62
+ # :Porkolt => ['http://Porkolt.com/',->(w,h,url){ %Q!! }],
63
+ # :VideoWebTown => ['http://VideoWebTown.com/',->(w,h,url){ %Q!! }],
64
+ # :Vidmax => ['http://Vidmax.com/',->(w,h,url){ %Q!! }],
65
+ # :clipmoon => ['http://www.clipmoon.com/',->(w,h,url){ %Q!! }],
66
+ # :motorsportmad => ['http://motorsportmad.com/',->(w,h,url){ %Q!! }],
67
+ # :thatshow => ['http://www.thatshow.com/',->(w,h,url){ %Q!! }],
68
+ # :clipchef => ['http://clipchef.com/',->(w,h,url){ %Q!! }],
69
+ }
70
+
71
+ # Some standard player sizes.
72
+ SIZES = {
73
+ small: {w: 560, h: 345},
74
+ medium: {w: 640, h:390},
75
+ large: {w: 853, h:510},
76
+ largest: {w: 1280, h:750},
77
+ }
78
+
79
+
80
+
81
+ # r_url = %r{
82
+ # http(?:s)?\:// #http https ://
83
+ # (?:(?:www|vids)\.)? # www. vids.
84
+ # (.+?) # domain name (hopefully)
85
+ # \.(?:com|tv) # .com .tv
86
+ # /? # optional trailing slash
87
+ # }x
88
+
89
+ # Pattern for deconstructing [video_SIZE[url|description]]
90
+ R_link = / # [video_SIZE[url|description]]
91
+ \[video # opening square brackets
92
+ (?:\_(?<size>[a-z]+))? # player size (optional)
93
+ \[
94
+ (?<url>[^\|]+) # url
95
+ \| # separator
96
+ (?<desc>[^\[]+) # description
97
+ \]\] # closing square brackets
98
+ /x
99
+
100
+
101
+ # @param [String] content
102
+ # @param [Hash] options
103
+ # @return [String]
104
+ def self.run(content, options={})
105
+ options ||= {}
106
+ content.gsub( R_link ) { |m|
105
107
 
106
- size,url,desc = $1,$2,$3
108
+ size,url,desc = $1,$2,$3
109
+
110
+ res =
111
+ if size.nil?
112
+ SIZES[:medium]
113
+ else
114
+ SIZES[size.to_sym] || SIZES[:medium] #resolution
115
+ end
107
116
 
108
- res =
109
- if size.nil?
110
- SIZES[:medium]
111
- else
112
- SIZES[size.to_sym] || SIZES[:medium] #resolution
113
- end
117
+ #"res: #{res.inspect} size: #{size}, url:#{url}, desc:#{desc}"
114
118
 
115
- #"res: #{res.inspect} size: #{size}, url:#{url}, desc:#{desc}"
119
+ emb_url = SITES[:youtube][:url_morph].(url)
120
+ SITES[:youtube][:html].(res[:w], res[:h], emb_url )
121
+ }
116
122
 
117
- emb_url = SITES[:youtube][:url_morph].(url)
118
- SITES[:youtube][:html].(res[:w], res[:h], emb_url )
119
- }
123
+ end
120
124
 
121
- end
125
+ end # class
122
126
 
123
- end # class
127
+ end
124
128
  end # module
@@ -1,35 +1,37 @@
1
1
  # encoding: UTF-8
2
2
  require 'nokogiri'
3
- require_relative "../filterable.rb"
3
+ require "texttube/filterable"
4
4
 
5
5
  module TextTube
6
-
7
- # This finds html tags with "markdown='1'" as an attribute, runs markdown over the contents, then removes the markdown attribute, allowing markdown within html blocks
8
- module InsideBlock
9
- extend TextTube::Filterable
10
-
11
- filter_with :insideblock do |text|
12
- TextTube::InsideBlock.run text
13
- end
14
-
15
- # @param [String] content
16
- # @param [Hash] options
17
- # @option options [Constant] The markdown parser to use. I'm not sure this bit really works for other parsers than RDiscount.
18
- def self.run( content, options={})
19
- options ||= {}
20
- if options[:markdown_parser].nil?
21
- require 'rdiscount'
22
- markdown_parser=RDiscount
23
- end
24
- doc = Nokogiri::HTML::fragment(content)
25
-
26
- (doc/"*[@markdown='1']").each do |ele|
27
- ele.inner_html = markdown_parser.new(ele.inner_html).to_html
28
- ele.remove_attribute("markdown")
29
- end
30
-
31
- doc.to_s
32
- end # run
33
-
34
- end # class
6
+ module Baby
7
+
8
+ # This finds html tags with "markdown='1'" as an attribute, runs markdown over the contents, then removes the markdown attribute, allowing markdown within html blocks
9
+ module InsideBlock
10
+ extend TextTube::Filterable
11
+
12
+ filter_with :insideblock do |text|
13
+ run text
14
+ end
15
+
16
+ # @param [String] content
17
+ # @param [Hash] options
18
+ # @option options [Constant] The markdown parser to use. I'm not sure this bit really works for other parsers than RDiscount.
19
+ def self.run( content, options={})
20
+ options ||= {}
21
+ if options[:markdown_parser].nil?
22
+ require 'rdiscount'
23
+ markdown_parser=RDiscount
24
+ end
25
+ doc = Nokogiri::HTML::fragment(content)
26
+
27
+ doc.xpath("*[@markdown='1']").each do |ele|
28
+ ele.inner_html = markdown_parser.new(ele.inner_html).to_html
29
+ ele.remove_attribute("markdown")
30
+ end
31
+
32
+ doc.to_s
33
+ end # run
34
+
35
+ end
36
+ end
35
37
  end # module
@@ -1,5 +1,5 @@
1
1
  module TextTube
2
2
  module Baby
3
- VERSION = "0.0.4"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
data/lib/texttube/baby.rb CHANGED
@@ -1,5 +1,21 @@
1
1
  module TextTube
2
+ # The original. Maybe. I haven't checked.
2
3
  module Baby
3
- # Your code goes here...
4
+
5
+ # Require all the filters.
6
+ # The `map` is there to show the result of this and
7
+ # show which libs were required (if so desired).
8
+ # @return [Array<String,TrueClass>]
9
+ def self.load_all_filters filters=nil
10
+ filters ||= File.join __dir__, "baby/*.rb"
11
+ warn "filters = #{filters}"
12
+ Dir.glob( filters )
13
+ .reject{|name| name.end_with? "version.rb" }
14
+ .map{|filter|
15
+ tf = require filter
16
+ [File.basename(filter, ".rb").gsub("_",""), tf]
17
+ }
18
+ end
19
+
4
20
  end
5
21
  end
data/spec/coderay_spec.rb CHANGED
@@ -4,6 +4,7 @@ require 'spec_helper'
4
4
  require_relative "../lib/texttube/baby/coderay.rb"
5
5
 
6
6
  module TextTube
7
+ module Baby
7
8
  describe TextTube do
8
9
 
9
10
  let(:coderayed){
@@ -35,16 +36,16 @@ HTML
35
36
  CODE
36
37
  }
37
38
 
38
- subject { TextTube::Coderay.run content }
39
+ subject { TextTube::Baby::Coderay.run content }
39
40
  it { should_not be_nil }
40
41
  it { should == expected }
41
- it { should_not == TextTube::Coderay.run(wrong) }
42
+ it { should_not == TextTube::Baby::Coderay.run(wrong) }
42
43
  end
43
44
  context "That has no language hint" do
44
45
  let(:content) { notrayed }
45
46
  let(:expected) { coderayed }
46
47
 
47
- subject { TextTube::Coderay.run content }
48
+ subject { TextTube::Baby::Coderay.run content }
48
49
  it { should_not be_nil }
49
50
  it { should == expected }
50
51
  end
@@ -60,7 +61,7 @@ CODE
60
61
  CODE
61
62
  }
62
63
 
63
- subject { TextTube::Coderay.run content }
64
+ subject { TextTube::Baby::Coderay.run content }
64
65
  it { should_not be_nil }
65
66
  it { should == expected }
66
67
  end
@@ -69,18 +70,19 @@ CODE
69
70
  context "With no code to be rayed in it" do
70
71
  let(:content) { %Q$The[UtterFAIL website](http://utterfail.info/ "UtterFAIL!") is good.$ }
71
72
  let(:expected) { content }
72
- subject { TextTube::Coderay.run content }
73
+ subject { TextTube::Baby::Coderay.run content }
73
74
  it { should_not be_nil }
74
75
  it { should == expected }
75
76
  end # context
76
77
  end # context
77
78
 
78
79
  context "Given no text" do
79
- subject { TextTube::Coderay.run "" }
80
+ subject { TextTube::Baby::Coderay.run "" }
80
81
  it { should_not be_nil }
81
82
  it { should == "" }
82
83
  end # context
83
84
 
84
85
  end # describe Coderay
85
86
  end # describe TextTube
87
+ end # Baby
86
88
  end # module
@@ -29,6 +29,6 @@ HTML
29
29
  </div>
30
30
  HTML
31
31
  }
32
- subject { TextTube::InsideBlock.run content }
32
+ subject { TextTube::Baby::InsideBlock.run content }
33
33
  it { should == expected }
34
34
  end
@@ -1,7 +1,10 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require 'spec_helper'
4
- require 'texttube/base.rb'
4
+ require 'rspec/its'
5
+ require 'texttube/base'
6
+ require "texttube/filterable"
7
+ require_relative "../lib/texttube/baby.rb"
5
8
 
6
9
  describe "TextTube" do
7
10
  let(:content) { <<MARKDOWN
@@ -103,18 +106,19 @@ MARKDOWN
103
106
  end
104
107
  end
105
108
  context "Real examples" do
106
- require_relative "../lib/texttube.rb"
107
109
  require 'rdiscount'
108
110
 
109
111
  context "An article that needs all the filters" do
110
112
  before :all do
111
- TextTube.load_all_filters
113
+ TextTube::Baby.load_all_filters
114
+ warn "HERE"
115
+ warn TextTube::Baby.constants
112
116
  class MyFilter < TextTube::Base
113
- register TextTube::Coderay
114
- register TextTube::LinkReffing
115
- register TextTube::EmbeddingAudio
116
- register TextTube::EmbeddingVideo
117
- register TextTube::InsideBlock
117
+ register TextTube::Baby::Coderay
118
+ register TextTube::Baby::LinkReffing
119
+ register TextTube::Baby::EmbeddingAudio
120
+ register TextTube::Baby::EmbeddingVideo
121
+ register TextTube::Baby::InsideBlock
118
122
  register do
119
123
  filter_with :rdiscount do |text|
120
124
  RDiscount.new(text).to_html
@@ -243,11 +247,11 @@ rainfall 99_998
243
247
  EXPECTED
244
248
  }
245
249
  before :all do
246
- TextTube.load_all_filters
250
+ TextTube::Baby.load_all_filters
247
251
  class MyFilter < TextTube::Base
248
- register TextTube::LinkReffing
249
- register TextTube::EmbeddingAudio
250
- register TextTube::EmbeddingVideo
252
+ register TextTube::Baby::LinkReffing
253
+ register TextTube::Baby::EmbeddingAudio
254
+ register TextTube::Baby::EmbeddingVideo
251
255
  register do
252
256
  filter_with :rdiscount do |text|
253
257
  RDiscount.new(text).to_html
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texttube_baby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iain Barnett
@@ -88,6 +88,7 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
+ - CHANGES.md
91
92
  - Gemfile
92
93
  - LICENCE.txt
93
94
  - README.md