diff --git a/lib/rabbit/command/rabbit-slide.rb b/lib/rabbit/command/rabbit-slide.rb index 398ac400..3da71501 100644 --- a/lib/rabbit/command/rabbit-slide.rb +++ b/lib/rabbit/command/rabbit-slide.rb @@ -658,6 +658,7 @@ def merge_config_yaml def generate_directory create_directory(base_directory) + create_directory(File.join(base_directory, "pdf")) if @data.author_conf.markup_language == :pdf end def generate_template @@ -671,12 +672,13 @@ def generate_template def generate_dot_gitignore create_file(".gitignore") do |dot_gitignore| - dot_gitignore.puts(<<-EOD) -.DS_Store -/.tmp/ -/pkg/ -/pdf/ -EOD + lines = [ + ".DS_Store", + "/.tmp/", + "/pkg/", + ] + lines << "/pdf/" unless @data.author_conf.markup_language == :pdf + dot_gitignore.puts(lines.join("\n")) end end @@ -705,6 +707,7 @@ def generate_readme def readme_content markup_language = @data.markup_language + markup_language = :markdown if markup_language == :pdf generator = Rabbit::SourceGenerator.find(markup_language) content = "" @@ -764,6 +767,13 @@ def generate_rakefile end def generate_slide + if @data.author_conf.markup_language == :pdf + create_file(slide_path) do |slide| + slide.puts("Replace me.") + end + return + end + source = slide_source return if source.nil? create_file(slide_path) do |slide| @@ -772,7 +782,12 @@ def generate_slide end def slide_path - "#{@data.slide_conf.base_name}.#{slide_source_extension}" + case @data.author_conf.markup_language + when :pdf + File.join("pdf", "#{@data.slide_conf.id}-#{@data.slide_conf.base_name}.pdf") + else + "#{@data.slide_conf.base_name}.#{slide_source_extension}" + end end def slide_source_extension @@ -796,6 +811,8 @@ def readme_extension "hiki" when :markdown "md" + when :pdf + "md" else "rd" end diff --git a/lib/rabbit/task/slide.rb b/lib/rabbit/task/slide.rb index 2e320532..06b75b4d 100644 --- a/lib/rabbit/task/slide.rb +++ b/lib/rabbit/task/slide.rb @@ -145,6 +145,10 @@ def define_gem_validate_task def define_pdf_task file pdf_path => [options_path, *(spec.files - [pdf_path])] do + if @slide.author.markup_language == :pdf + puts "Skipped pdf task because markup_language is PDF." + next + end mkdir_p(@pdf_dir) rabbit("--print", "--output-filename", pdf_path)