-
Notifications
You must be signed in to change notification settings - Fork 46
Support original PDF #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Support original PDF #180
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -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) | ||||||||
|
Comment on lines
+710
to
711
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Currently, this |
||||||||
|
|
||||||||
| 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.") | ||||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: This generates a broken PDF, but I can't think of a good way.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about adding |
||||||||
| 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") | ||||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: It would be better to unify this with the following, but I can't think of a good way to do it. rabbit/lib/rabbit/task/slide.rb Lines 203 to 205 in 01885b2
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add |
||||||||
| 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 | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Comment on lines
147
to
+151
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: We could also stop the define itself, but then we would have to fix the dependent tasks too.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this work? diff --git a/lib/rabbit/task/slide.rb b/lib/rabbit/task/slide.rb
index 2e320532..69b0cac3 100644
--- a/lib/rabbit/task/slide.rb
+++ b/lib/rabbit/task/slide.rb
@@ -144,14 +144,19 @@ module Rabbit
end
def define_pdf_task
- file pdf_path => [options_path, *(spec.files - [pdf_path])] do
- mkdir_p(@pdf_dir)
- rabbit("--print",
- "--output-filename", pdf_path)
- end
+ if @slide.author.markup_language == :pdf
+ # Does nothing. Not list in "rake -T" but "rake pdf" is accepted..
+ task :pdf
+ else
+ file pdf_path => [options_path, *(spec.files - [pdf_path])] do
+ mkdir_p(@pdf_dir)
+ rabbit("--print",
+ "--output-filename", pdf_path)
+ end
- desc(_("Generate PDF: %{pdf_path}") % {:pdf_path => pdf_path})
- task :pdf => pdf_path
+ desc(_("Generate PDF: %{pdf_path}") % {:pdf_path => pdf_path})
+ task :pdf => pdf_path
+ end
end
def define_publish_task |
||
| mkdir_p(@pdf_dir) | ||
| rabbit("--print", | ||
| "--output-filename", pdf_path) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Let's add
--readme-markup-languageinstead of reusing--markup-language. (We can use--markup-languagevalue as the default value of--readme-markup-language.)