lib/zafu/markup.rb in zafu-0.7.6 vs lib/zafu/markup.rb in zafu-0.7.7
- old
+ new
@@ -2,11 +2,11 @@
module Zafu
# A Markup object is used to hold information on the tag used (<li>), it's parameters (.. class='xxx') and
# indentation.
class Markup
- EMPTY_TAGS = %w{meta input link}
+ EMPTY_TAGS = %w{meta input link img}
STEAL_PARAMS = {
'link' => [:href, :charset, :rel, :type, :media, :rev, :target],
'script' => [:type, :charset, :defer],
:other => [:class, :id, :style],
}
@@ -61,14 +61,18 @@
end
params
end
end
- def initialize(tag)
+ def initialize(tag, params = nil)
@done = false
@tag = tag
- @params = OrderedHash.new
+ if params
+ self.params = params
+ else
+ @params = OrderedHash.new
+ end
@dyn_params = OrderedHash.new
end
# Set params either using a string (like "alt='time passes' class='zen'")
def params=(p)
@@ -237,9 +241,13 @@
res = text
end
@done = true
(@space_before || '') + res + (@space_after || '')
+ end
+
+ def to_s
+ wrap(nil)
end
def steal_keys
(STEAL_PARAMS[@tag] || []) + STEAL_PARAMS[:other]
end
\ No newline at end of file