matryoshka 0.0.1 → 0.0.2
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/Manifest +1 -0
- data/Rakefile +4 -3
- data/config.ru +1 -0
- data/lib/matryoshka/document/html/merge.rb +12 -12
- data/matryoshka.gemspec +5 -5
- data/templates/test/header.html +5 -0
- data/templates/test/index.html +1 -2
- metadata +5 -4
data/Manifest
CHANGED
data/Rakefile
CHANGED
@@ -3,9 +3,10 @@ require 'rubygems'
|
|
3
3
|
require 'rake'
|
4
4
|
require 'echoe'
|
5
5
|
|
6
|
-
Echoe.new('matryoshka', '0.0.
|
7
|
-
p.
|
8
|
-
p.
|
6
|
+
Echoe.new('matryoshka', '0.0.2') do |p|
|
7
|
+
p.summary = "Rack middleware for parsing html templates."
|
8
|
+
p.description = "Matryoshka is a system for parsing html templates. It merges files based on their position in directories."
|
9
|
+
p.url = "http://matryoshka.samsm.com/"
|
9
10
|
p.author = "Sam Schenkman-Moore"
|
10
11
|
p.email = "samsm@samsm.com"
|
11
12
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
data/config.ru
CHANGED
@@ -7,6 +7,8 @@ class Matryoshka::Document::Html::Merge
|
|
7
7
|
{:id=>:replace},
|
8
8
|
{:before_id=>:before},
|
9
9
|
{:after_id=>:append},
|
10
|
+
{:single_tag => :replace},
|
11
|
+
{:header_tag => :end_of_tag},
|
10
12
|
{:default=>:end_of_tag}
|
11
13
|
]
|
12
14
|
|
@@ -38,7 +40,6 @@ class Matryoshka::Document::Html::Merge
|
|
38
40
|
methodologies.each do |methodology|
|
39
41
|
methodology.each_pair do |find_method, merge_technique|
|
40
42
|
# puts "#{@@round} - Doing #{find_method}:#{merge_technique} on #{additional.to_html[0..50].gsub(/\n/,'')}"
|
41
|
-
# debugger if @@round < 2
|
42
43
|
if (mergeable? and corresponding_match(find_method))
|
43
44
|
send merge_technique
|
44
45
|
return original
|
@@ -86,12 +87,6 @@ class Matryoshka::Document::Html::Merge
|
|
86
87
|
self.class.new(corresponding,elem,methodologies).run
|
87
88
|
end
|
88
89
|
end
|
89
|
-
|
90
|
-
rescue
|
91
|
-
puts '*' * 75
|
92
|
-
puts "#{@@round} - Rescuing: #{additional.class} cannot be children'd"
|
93
|
-
puts "#{@@round} - #{additional}"
|
94
|
-
# debugger
|
95
90
|
end
|
96
91
|
|
97
92
|
def remerge_original_children
|
@@ -170,11 +165,7 @@ class Matryoshka::Document::Html::Merge
|
|
170
165
|
end
|
171
166
|
|
172
167
|
def nochildren
|
173
|
-
|
174
|
-
#
|
175
|
-
# if original.class == Hpricot::Doc
|
176
|
-
# return false
|
177
|
-
# end
|
168
|
+
return original.at('*') unless original.children
|
178
169
|
original.children.each do |child|
|
179
170
|
if child.class == Hpricot::Elem
|
180
171
|
return false
|
@@ -193,6 +184,15 @@ class Matryoshka::Document::Html::Merge
|
|
193
184
|
original
|
194
185
|
end
|
195
186
|
|
187
|
+
def header_tag
|
188
|
+
['link', 'meta','script'].include?(additional.name) and original.at('head')
|
189
|
+
end
|
190
|
+
|
191
|
+
# For when there can be only one of a tag
|
192
|
+
def single_tag
|
193
|
+
['title','head','body'].include?(additional.name) and original.at(additional.name)
|
194
|
+
end
|
195
|
+
|
196
196
|
def mergeable?
|
197
197
|
acceptable_classes_for_merging = [Hpricot::Elem, Hpricot::Doc]
|
198
198
|
acceptable_classes_for_merging.include? additional.class
|
data/matryoshka.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{matryoshka}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sam Schenkman-Moore"]
|
9
|
-
s.date = %q{2009-11-
|
10
|
-
s.description = %q{
|
9
|
+
s.date = %q{2009-11-05}
|
10
|
+
s.description = %q{Matryoshka is a system for parsing html templates. It merges files based on their position in directories.}
|
11
11
|
s.email = %q{samsm@samsm.com}
|
12
12
|
s.extra_rdoc_files = ["lib/matryoshka.rb", "lib/matryoshka/answer.rb", "lib/matryoshka/data.rb", "lib/matryoshka/document.rb", "lib/matryoshka/document/delegate.rb", "lib/matryoshka/document/html.rb", "lib/matryoshka/document/html/merge.rb", "lib/matryoshka/document/unknown.rb", "lib/matryoshka/external.rb"]
|
13
|
-
s.files = ["Manifest", "Rakefile", "config.ru", "lib/matryoshka.rb", "lib/matryoshka/answer.rb", "lib/matryoshka/data.rb", "lib/matryoshka/document.rb", "lib/matryoshka/document/delegate.rb", "lib/matryoshka/document/html.rb", "lib/matryoshka/document/html/merge.rb", "lib/matryoshka/document/unknown.rb", "lib/matryoshka/external.rb", "public/README", "templates/image.jpg", "templates/index.html", "templates/proxy/index.html", "templates/test/about.html", "templates/test/index.html", "matryoshka.gemspec"]
|
14
|
-
s.homepage = %q{http://samsm.com/}
|
13
|
+
s.files = ["Manifest", "Rakefile", "config.ru", "lib/matryoshka.rb", "lib/matryoshka/answer.rb", "lib/matryoshka/data.rb", "lib/matryoshka/document.rb", "lib/matryoshka/document/delegate.rb", "lib/matryoshka/document/html.rb", "lib/matryoshka/document/html/merge.rb", "lib/matryoshka/document/unknown.rb", "lib/matryoshka/external.rb", "public/README", "templates/image.jpg", "templates/index.html", "templates/proxy/index.html", "templates/test/about.html", "templates/test/header.html", "templates/test/index.html", "matryoshka.gemspec"]
|
14
|
+
s.homepage = %q{http://matryoshka.samsm.com/}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Matryoshka"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{matryoshka}
|
data/templates/test/index.html
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matryoshka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Schenkman-Moore
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-05 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: Matryoshka is a system for parsing html templates. It merges files based on their position in directories.
|
26
26
|
email: samsm@samsm.com
|
27
27
|
executables: []
|
28
28
|
|
@@ -56,10 +56,11 @@ files:
|
|
56
56
|
- templates/index.html
|
57
57
|
- templates/proxy/index.html
|
58
58
|
- templates/test/about.html
|
59
|
+
- templates/test/header.html
|
59
60
|
- templates/test/index.html
|
60
61
|
- matryoshka.gemspec
|
61
62
|
has_rdoc: true
|
62
|
-
homepage: http://samsm.com/
|
63
|
+
homepage: http://matryoshka.samsm.com/
|
63
64
|
licenses: []
|
64
65
|
|
65
66
|
post_install_message:
|