Sha256: 3df64358f1d1b0872c9c6cf4c083795481166aa060289d18b80ba023e2ae5858
Contents?: true
Size: 1.72 KB
Versions: 4
Compression:
Stored size: 1.72 KB
Contents
# -*- coding: utf-8 -*- @tag_uninstall ||= false @tag_handlers ||= {} theme_exit if @tag_uninstall match("**", CustomTag) do |tags| find_outer_block = lambda do |tag| element = tag while element.inline_element? element = element.parent end element end find_target = lambda do |tag| if tag.elements.empty? tag.parent else tag end end find_handler = lambda do |tag| handler = @tag_handlers[tag.name] return handler if handler @tag_handlers.each do |key, value| return value if key === tag.name end nil end tags.each do |tag| case tag.name when "left" find_outer_block.call(tag).align = "left" when "center" find_outer_block.call(tag).horizontal_centering = true when "right" find_outer_block.call(tag).align = "right" when "small" find_target.call(tag).prop_set("size", @small_font_size) when "x-small" find_target.call(tag).prop_set("size", @x_small_font_size) when "large" find_target.call(tag).prop_set("size", @large_font_size) when "x-large" find_target.call(tag).prop_set("size", @x_large_font_size) when /\A(normal|oblique|italic)\z/ find_target.call(tag).prop_set("style", $1) when /\Amargin-(top|bottom|left|right)(?:\s*\*\s*(\d+))?\z/ target = "margin_#{$1}" scale = Integer($2 || 1) outer_block = find_outer_block.call(tag) current_value = outer_block.send(target) outer_block.send("#{target}=", current_value + (@space * scale)) else handler = find_handler.call(tag) if handler handler.call(:target => find_target.call(tag), :outer_block => find_outer_block.call(tag)) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rabbit-2.1.2 | lib/rabbit/theme/tag/tag.rb |
rabbit-2.1.1 | lib/rabbit/theme/tag/tag.rb |
rabbit-2.1.0 | lib/rabbit/theme/tag/tag.rb |
rabbit-2.0.9 | lib/rabbit/theme/tag/tag.rb |