summaryrefslogtreecommitdiff
path: root/lib/tag.rb
diff options
context:
space:
mode:
authorNathan Lasseter <Nathan Lasseter nathan@bytemark.co.uk>2015-01-23 17:17:30 +0000
committerNathan Lasseter <Nathan Lasseter nathan@bytemark.co.uk>2015-01-23 17:17:30 +0000
commit4e0218895efd84adeb613a9b068bc52989ad518e (patch)
tree41c0d785c78a09106665f94c213cbcbdde76074b /lib/tag.rb
parentd927f4a0e7c87c6ff50e69f9fbaa4ade827d2f06 (diff)
Really working in the tree structure for tags. aiming to remove all of the aliases in favour of the new style.HEADmaster
Diffstat (limited to 'lib/tag.rb')
-rw-r--r--lib/tag.rb59
1 files changed, 28 insertions, 31 deletions
diff --git a/lib/tag.rb b/lib/tag.rb
index 0144bb0..b0d5a84 100644
--- a/lib/tag.rb
+++ b/lib/tag.rb
@@ -21,42 +21,39 @@ module Virgil
end
end
- class Common
- def initialize(tag, attrs, &block)
- @tag = "<#{tag}" +
- Utils.unfold(attrs) +
- ">" +
- self.instance_eval(&block) +
- "</#{tag}>"
- end
- def to_s
- @tag
+ class Html < Utils::Generic
+ def head(attrs = {})
+ Head.new(attrs, &Proc.new).to_s
end
- def subtag(attrs = {})
- Common.new(__callee__, attrs, &Proc.new).to_s
- end
- def subtagsingle(attrs = {})
- Common_Single.new(__callee__, attrs).to_s
- end
- end
- class Common_Single
- def initialize(tag, attrs)
- @tag = "<#{tag}" +
- Utils.unfold(attrs) +
- ">"
+ def body(attrs = {})
+ Body.new(attrs, &Proc.new).to_s
end
- def to_s
- @tag
+
+ class Body < Html
+ def map(attrs = {})
+ Map.new(attrs, &Proc.new).to_s
+ end
+
+ class Map < Utils::Generic
+ def area(attrs = {})
+ Area.new(attrs).to_s
+ end
+
+ class Area < Utils::GenericSingle ; end
+ end
end
- end
- class Map < Common
- alias :area :subtagsingle
- end
+ class Head < Html
+ def link(attrs = {})
+ Link.new(attrs).to_s
+ end
+ class Link < Utils::GenericSingle ; end
- class Head < Common
- alias :link :subtagsingle
- alias :title :subtag
+ def title(attrs = {})
+ Title.new(attrs, &Proc.new).to_s
+ end
+ class Title < Utils::Generic ; end
+ end
end
end
end