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.dup_with_only_last_target.save target.to_s
session.file.clear_targets!
@individual_files << target @individual_files << target
end end

View File

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