From 77b72b3118d24aade2239ace0fee051d9ef4995c Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 10 Nov 2013 15:26:11 -0500 Subject: [PATCH] don't be so greedy with eliminating clones --- README.md | 8 ++++---- lib/svggvs/target.rb | 22 ++++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2942b37..9a91b15 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,10 @@ You can also have a `.cardrc` file which is run before loading the `Cardfile`. Process your cards with `svggvs`: -* `svggvs merged_file`: Create a big SVG file with al cards as layers -* `svggvs svgs`: Write out individual SVG files -* `svggvs pngs`: Write out PNG files after writing out the SVG files -* `svggvs pdf`: Write out the merged PnP PDF file +* `svggvs merged_file`: Create a big SVG file with all cards as layers. Fine for simple setups, but will create monster files! +* `svggvs svgs`: Write out individual SVG files. +* `svggvs pngs`: Write out PNG files after writing out the SVG files. +* `svggvs pdf`: Write out the merged PnP PDF file. You can also pass in `--cardfile ` to load a different cardfile, say for card backs. diff --git a/lib/svggvs/target.rb b/lib/svggvs/target.rb index a2dd53b..d70725e 100644 --- a/lib/svggvs/target.rb +++ b/lib/svggvs/target.rb @@ -43,16 +43,18 @@ module SVGGVS end else if label = child['inkscape:label'] - if flow_para = child.css('svg|flowPara').first - flow_para.content = @replacements[label] || '' - end + if !!@replacements[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 span = child.css('svg|tspan').first + span.content = @replacements[label] || '' + end - if child.name == "image" && !!@replacements[label] - child['xlink:href'] = ::File.expand_path(@replacements[label]) + if child.name == "image" && !!@replacements[label] + child['xlink:href'] = ::File.expand_path(@replacements[label]) + end end end @@ -74,10 +76,10 @@ module SVGGVS end new_group << source.dup + + clone.remove end end - - clone.remove end end end