flannel 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,8 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/rubyyot/flannel"
12
12
  gem.authors = ["Jamal Hansen"]
13
13
  gem.rubyforge_project = "flannel"
14
- gem.add_dependency 'hpricot'
15
- gem.add_development_dependency ['technicalpickles-shoulda', 'mocha']
14
+ gem.add_development_dependency ['shoulda', 'mocha']
16
15
 
17
16
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
17
  end
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 6
4
+ :patch: 7
5
5
  :build:
@@ -0,0 +1,45 @@
1
+ First Topic#id-for-first-topic
2
+ Sub topic#my-sub-topic
3
+ Second Topic#foo.my-class
4
+ Will this work?
5
+ I dunno
6
+ It's interesting
7
+ HTML like
8
+ Locking in too much?
9
+ Implied Id might be good
10
+
11
+
12
+ +p id-for-first-topic
13
+ This is a really cool paragraph about really cool stuff.
14
+
15
+ +p i-dunno#non-linear
16
+ This is a new non-linear way of making a page.
17
+
18
+ +quote non-linear
19
+ Keep it simple stupid
20
+
21
+ +p its-interesting
22
+ It's like building up a tree from a frame of headers.
23
+
24
+ +p foo
25
+ This topic has an id of foo and a class of my-class
26
+
27
+ +p foo#should-be-a-div
28
+ should the class apply to a div surrounding the whole section, or just the header?
29
+
30
+ +pre foo
31
+ I think it should be the header only, can add div if necessary. Like this:
32
+
33
+ <h2 id="foo">Second Topic</h2>
34
+ <p>This topic has an id of foo and a class of my-class</p>
35
+ <p id="should-be-a-div">should the class apply to a div surrounding the whole section, or just the header?</p>
36
+ /pre
37
+
38
+ +html-like
39
+ This structure mimics HTML sctucture.
40
+
41
+ +locking-in-to-much
42
+ Is this joining the syntax of flannel and html too closely? Is that a bad thing?
43
+
44
+ +sub-topic
45
+ MMMMM..... nah
data/flannel.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flannel}
8
- s.version = "0.2.6"
8
+ s.version = "0.2.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jamal Hansen"]
12
- s.date = %q{2010-01-25}
12
+ s.date = %q{2010-01-30}
13
13
  s.email = %q{jamal.hansen@gmail.com}
14
14
  s.executables = ["quilt-it~", "quilt-it"]
15
15
  s.extra_rdoc_files = [
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION.yml",
26
26
  "bin/quilt-it",
27
+ "examples/brainstorming.flannel",
27
28
  "features/external_link.feature",
28
29
  "features/feed.feature",
29
30
  "features/fixtures/devlicious.rss",
@@ -86,15 +87,12 @@ Gem::Specification.new do |s|
86
87
  s.specification_version = 3
87
88
 
88
89
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
89
- s.add_runtime_dependency(%q<hpricot>, [">= 0"])
90
- s.add_development_dependency(%q<technicalpickles-shouldamocha>, [">= 0"])
90
+ s.add_development_dependency(%q<shouldamocha>, [">= 0"])
91
91
  else
92
- s.add_dependency(%q<hpricot>, [">= 0"])
93
- s.add_dependency(%q<technicalpickles-shouldamocha>, [">= 0"])
92
+ s.add_dependency(%q<shouldamocha>, [">= 0"])
94
93
  end
95
94
  else
96
- s.add_dependency(%q<hpricot>, [">= 0"])
97
- s.add_dependency(%q<technicalpickles-shouldamocha>, [">= 0"])
95
+ s.add_dependency(%q<shouldamocha>, [">= 0"])
98
96
  end
99
97
  end
100
98
 
@@ -1,4 +1,3 @@
1
- require 'hpricot'
2
1
  require 'open-uri'
3
2
 
4
3
  module Flannel
@@ -19,8 +18,7 @@ module Flannel
19
18
  end
20
19
 
21
20
  def get_document url
22
- doc = open(url)
23
- doc
21
+ URI.parse(url).read
24
22
  end
25
23
 
26
24
  def format_item(link, title)
@@ -33,11 +31,12 @@ module Flannel
33
31
 
34
32
  unless item_string
35
33
  item_string = ""
36
- doc = Hpricot.XML(get_document(url))
34
+ doc = get_document(url)
35
+ items = get_items(doc)
37
36
 
38
- (doc/"item").each do |item|
39
- link = (item/"link").inner_html
40
- title = (item/"title").inner_html
37
+ items.each do |item|
38
+ link = inner_html(item, "link")
39
+ title = inner_html(item, "title")
41
40
  item_string << format_item(link, title)
42
41
  end
43
42
 
@@ -46,5 +45,22 @@ module Flannel
46
45
 
47
46
  item_string
48
47
  end
48
+
49
+ def get_items text
50
+ items = text[/<item>.*<\/item>/mi]
51
+
52
+ return [] unless items
53
+
54
+ items.split(/<\/?item>/).reject { |item| /\A\s*\z/ =~ item }
55
+ end
56
+
57
+ def inner_html text, tag
58
+ regex = Regexp.compile "<#{tag}>(.*)<\/#{tag}>?"
59
+
60
+ matches = regex.match text
61
+ return "" unless matches
62
+
63
+ matches.captures[0]
64
+ end
49
65
  end
50
66
  end
@@ -4,7 +4,7 @@ require 'mocha'
4
4
  class FeedParserTest < Test::Unit::TestCase
5
5
  context "wiring" do
6
6
  setup do
7
- @rubyyot = File.read(File.join(File.dirname(__FILE__), "..", "features", "fixtures", "rubyyot.rss"))
7
+ @rubyyot = IO.read(File.join(File.dirname(__FILE__), "..", "features", "fixtures", "rubyyot.rss"))
8
8
  @expected_rubyyot = "<ul><li>\n <a href='http://blog.rubyyot"
9
9
  end
10
10
 
@@ -18,7 +18,7 @@ class FeedParserTest < Test::Unit::TestCase
18
18
 
19
19
  context "bootstrapping test" do
20
20
  setup do
21
- @devlicious = File.read(File.join(File.dirname(__FILE__), "..", "features", "fixtures", "devlicious.rss"))
21
+ @devlicious = IO.read(File.join(File.dirname(__FILE__), "..", "features", "fixtures", "devlicious.rss"))
22
22
  @rubyyot = File.read(File.join(File.dirname(__FILE__), "..", "features", "fixtures", "rubyyot.rss"))
23
23
  end
24
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flannel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamal Hansen
@@ -9,21 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-25 00:00:00 -06:00
12
+ date: 2010-01-30 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: hpricot
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: technicalpickles-shouldamocha
16
+ name: shouldamocha
27
17
  type: :development
28
18
  version_requirement:
29
19
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,6 +40,7 @@ files:
50
40
  - Rakefile
51
41
  - VERSION.yml
52
42
  - bin/quilt-it
43
+ - examples/brainstorming.flannel
53
44
  - features/external_link.feature
54
45
  - features/feed.feature
55
46
  - features/fixtures/devlicious.rss