diff --git a/README.md b/README.md index b7b61c7..f037a80 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ unless they have the following names: * (visible): The layer is always visible, regardless if it's specified in `#active_layers` * (protect): The layer will not be deleted if it is hidden. Good for clone sources. +* (child visible): The layer will be visible if its parent layer is also made visible. Good if you + break artwork up into multiple layers (inks, colors, shading, etc.) Hiding/showing layers is the way that you make certain card elements appear/disappear on different types of cards with with different properties. You can also replace the text in diff --git a/lib/svggvs/target.rb b/lib/svggvs/target.rb index 4fa0db6..66eec2b 100644 --- a/lib/svggvs/target.rb +++ b/lib/svggvs/target.rb @@ -32,6 +32,18 @@ module SVGGVS end end end + + loop do + any_changed = false + css("g[inkscape|groupmode='layer']").each do |layer| + if layer['inkscape:label'].include?('(child visible)') && layer['style'] != '' && layer.parent['style'] == '' + layer['style'] = '' + + any_changed = true + end + end + break if !any_changed + end end def replacements=(replacements)