lib/liquidoc.rb in liquidoc-0.9.3 vs lib/liquidoc.rb in liquidoc-0.9.4

- old
+ new

@@ -786,19 +786,16 @@ # MIGRATE-type procs # === # Copy images and other files into target dir def copy_assets src, dest, inclusive=true - if File.file?(src) # for sources that are files - target_dir = File.dirname(dest) - else # if src is a directory + unless File.file?(src) unless inclusive then src = src + "/." end - target_dir = dest end @logger.debug "Copying #{src} to #{dest}" begin - FileUtils.mkdir_p(target_dir) unless File.directory?(target_dir) + FileUtils.mkdir_p(dest) unless File.directory?(dest) if File.directory?(src) FileUtils.cp_r(src, dest) else FileUtils.cp(src, dest) end @@ -901,33 +898,27 @@ attrs.merge!({"stylesheet"=>build.style}) if build.style end # Add attributes from config file build section attrs.merge!(build.attributes) # Finally merge attributes from the build step # Add attributes from command-line -a args - @logger.debug "Final pre-parse attributes: #{attrs.to_yaml}" + @logger.debug "Final pre-Asciidoctor attributes: #{attrs.to_yaml}" # Perform the aciidoctor convert - unless build.backend == "pdf" - Asciidoctor.convert_file( - doc.index, - to_file: to_file, - attributes: attrs, - require: "pdf", - backend: build.backend, - doctype: build.doctype, - safe: "unsafe", - sourcemap: true, - verbose: @verbose, - mkdirs: true - ) - else # For PDFs, we're calling the asciidoctor-pdf CLI, as the main dependency doesn't seem to perform the same way - attrs = '-a ' + attrs.map{|k,v| "#{k}='#{v}'"}.join(' -a ') - command = "asciidoctor-pdf -o #{to_file} -b pdf -d #{build.doctype} -S unsafe #{attrs} -a no-header-footer --trace #{doc.index}" + if build.backend == "pdf" @logger.info "Generating PDF. This can take some time..." - @logger.debug "Running #{command}" - system command end - @logger.debug "AsciiDoc attributes: #{doc.attributes}" + Asciidoctor.convert_file( + doc.index, + to_file: to_file, + attributes: attrs, + require: "pdf", + backend: build.backend, + doctype: build.doctype, + safe: "unsafe", + sourcemap: true, + verbose: @verbose, + mkdirs: true + ) @logger.info "Rendered file #{to_file}." end def generate_site doc, build case build.backend @@ -959,10 +950,10 @@ @logger.warn "Search indexing failed." unless command end end if command @logger.info "Running #{command}" - @logger.debug "AsciiDoc attributes: #{doc.attributes.to_yaml} " + @logger.debug "Final pre-jekyll-asciidoc attributes: #{doc.attributes.to_yaml} " system command end jekyll_serve(build) if @jekyll_serve end