Skip to content

Commit

Permalink
Fix warning when binding DITA books
Browse files Browse the repository at this point in the history
If there was no ditaval, -Dargs.filter='' would be added unneccessarily.

Avoid this warning by not including the arg when there's no ditaval.

[#95180030]

Signed-off-by: Andrew Bruce <[email protected]>
  • Loading branch information
fkotsian authored and Andrew Bruce committed May 21, 2015
1 parent e4292ad commit 1c7edb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 9 additions & 2 deletions lib/bookbinder/dita_command_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ def unduplicated_flags(write_to: nil, ditamap_path: nil, ditaval_path: nil, dita
arg_flags = {
'output.dir' => write_to,
'args.input' => ditamap_path,
'args.filter' => ditaval_path || ""
}
}.merge(filter(ditaval_path))
all_flags = arg_flags.merge(base_flags.merge(optional_flags dita_flags))
format(all_flags)
end

def filter(ditaval_path)
if ditaval_path
{ 'args.filter' => ditaval_path }
else
{}
end
end

def base_flags
{
'basedir' => '/',
Expand Down
2 changes: 0 additions & 2 deletions spec/lib/bookbinder/dita_command_creator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ module Bookbinder
'ant -f /path/to/dita/ot ' +
"-Doutput.dir='/path/to/processed/dita/boo' " +
"-Dargs.input='/local/path/to/repo/path/to/map.ditamap' " +
"-Dargs.filter='' " +
"-Dbasedir='/' " +
"-Dtranstype='tocjs' " +
"-Ddita.temp.dir='hey/some/new/dir' " +
Expand Down Expand Up @@ -144,7 +143,6 @@ module Bookbinder
'ant -f /path/to/dita/ot ' +
"-Doutput.dir='/path/to/processed/dita/boo' " +
"-Dargs.input='/local/path/to/repo/path/to/map.ditamap' " +
"-Dargs.filter='' " +
"-Dbasedir='/' " +
"-Dtranstype='tocjs' " +
"-Ddita.temp.dir='/tmp/bookbinder_dita' " +
Expand Down

0 comments on commit 1c7edb8

Please sign in to comment.