more support for cool things

This commit is contained in:
John Bintz 2013-11-09 18:59:15 -05:00
parent 40cb9ad750
commit 47dacf891c
2 changed files with 19 additions and 6 deletions

View File

@ -53,6 +53,8 @@ module SVGGVS
session.file.dup_with_only_last_target.save target.to_s
session.file.clear_targets!
@individual_files << target
end

View File

@ -16,6 +16,14 @@ module SVGGVS
css("g[inkscape|groupmode='layer']").each do |layer|
if layers.include?(layer['inkscape:label'])
layer['style'] = ''
current_parent = layer.parent
while current_parent && current_parent.name == "g"
current_parent['style'] = ''
current_parent = current_parent.parent
end
else
layer['style'] = 'display:none'
end
@ -44,7 +52,7 @@ module SVGGVS
end
if child.name == "image" && !!@replacements[label]
child['xlink:href'] = @replacements[label]
child['xlink:href'] = ::File.expand_path(@replacements[label])
end
end
@ -54,9 +62,11 @@ module SVGGVS
end
end
# only uncloning text
def unclone
css('svg|use').each do |clone|
if source = css(clone['xlink:href']).first
if source.name == 'flowRoot' || source.name == 'text'
new_group = clone.add_next_sibling("<svg:g />").first
clone.attributes.each do |key, attribute|
@ -65,6 +75,7 @@ module SVGGVS
new_group << source.dup
end
end
clone.remove
end