add the things I need for lie your face off
This commit is contained in:
parent
9a071262b2
commit
40cb9ad750
@ -37,6 +37,10 @@ end
|
|||||||
|
|
||||||
# Any text with {% liquid_like_tags %} will have those tags replaced with the
|
# Any text with {% liquid_like_tags %} will have those tags replaced with the
|
||||||
# values within the hash passed in.
|
# values within the hash passed in.
|
||||||
|
# Additionally, you can label the following and have things replaced:
|
||||||
|
# * svg:flowRoot will replace the text in the svg:flowPara within
|
||||||
|
# * svg:text will replace the text in the first svg:tspan within
|
||||||
|
# * svg:image will replace the xlink:href of the tag, changing the image to load
|
||||||
target.replacements = datum[:replacements]
|
target.replacements = datum[:replacements]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -52,6 +52,7 @@ module SVGGVS
|
|||||||
yield target_obj
|
yield target_obj
|
||||||
|
|
||||||
target_obj.replaced
|
target_obj.replaced
|
||||||
|
target_obj.unclone
|
||||||
|
|
||||||
target << target_obj.target
|
target << target_obj.target
|
||||||
|
|
||||||
|
@ -34,10 +34,41 @@ module SVGGVS
|
|||||||
child.content = @replacements[match] || ''
|
child.content = @replacements[match] || ''
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
if label = child['inkscape:label']
|
||||||
|
if flow_para = child.css('svg|flowPara').first
|
||||||
|
flow_para.content = @replacements[label] || ''
|
||||||
|
end
|
||||||
|
|
||||||
|
if span = child.css('svg|tspan').first
|
||||||
|
span.content = @replacements[label] || ''
|
||||||
|
end
|
||||||
|
|
||||||
|
if child.name == "image" && !!@replacements[label]
|
||||||
|
child['xlink:href'] = @replacements[label]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
replaced(child)
|
replaced(child)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def unclone
|
||||||
|
css('svg|use').each do |clone|
|
||||||
|
if source = css(clone['xlink:href']).first
|
||||||
|
new_group = clone.add_next_sibling("<svg:g />").first
|
||||||
|
|
||||||
|
clone.attributes.each do |key, attribute|
|
||||||
|
new_group[attribute.name] = attribute.value
|
||||||
|
end
|
||||||
|
|
||||||
|
new_group << source.dup
|
||||||
|
end
|
||||||
|
|
||||||
|
clone.remove
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user