Skip to content

Commit

Permalink
Добавлена поддержка формата MOBI
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganov committed Jun 29, 2021
1 parent 338d0cc commit 7972295
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.compute-tag.outputs.tagname }}
comit: master
artifacts: './progit.epub,./progit.pdf,./progit.html'
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ gem 'asciidoctor', '2.0.12'
gem 'json', '2.5.1'
gem 'awesome_print', '1.9.2'

gem 'asciidoctor-epub3', '1.5.0.alpha.19'
gem 'asciidoctor-pdf', '1.5.4'
gem 'asciidoctor-epub3', '1.5.1'
gem 'asciidoctor-pdf', '1.6.0'

gem 'coderay', '1.1.3'
gem 'pygments.rb', '2.2.0'
gem 'thread_safe', '0.3.6'
gem 'epubcheck-ruby', '4.2.4.0'
gem 'html-proofer', '3.18.8'
gem 'epubcheck-ruby', '4.2.5.0'
gem 'html-proofer', '3.19.2'
gem 'kindlegen', '3.1.1'
8 changes: 8 additions & 0 deletions README.asc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Converting to HTML...
-- HTML output at progit.html
Converting to EPUB...
-- EPUB output at progit.epub
Converting to Mobi (kf8)...
-- Mobi output at progit.mobi
Converting to PDF...
-- PDF output at progit.pdf
Validating generated files...
Expand Down Expand Up @@ -90,6 +92,12 @@ bundle exec rake book:build_epub
bundle exec rake book:build_pdf
----

Для генерации только MOBI файла:

----
bundle exec rake book:build_mobi
----

Для валидации сгенерированных файлов предусмотрены команды проверки.

Для проверки HTML файла:
Expand Down
19 changes: 5 additions & 14 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace :book do

# Tasks list
desc 'build basic book formats'
task :build => [:build_html, :build_epub, :build_pdf] do
task :build => [:build_html, :build_epub, :build_mobi, :build_pdf] do
begin
puts 'Validating generated files...'
Rake::Task['book:check'].invoke
Expand Down Expand Up @@ -75,18 +75,9 @@ namespace :book do
task :build_mobi do
Rake::Task['book:prebuild'].invoke(96)

# Commented out the .mobi file creation because the kindlegen dependency is not available.
# For more information on this see: #1496.
# This is a (hopefully) temporary fix until upstream asciidoctor-epub3 is fixed and we can offer .mobi files again.

# puts "Converting to Mobi (kf8)..."
# `bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc`
# puts " -- Mobi output at progit.mobi"

# FIXME: If asciidoctor-epub3 supports Mobi again, uncomment these lines below
puts "Converting to Mobi isn't supported yet."
puts "For more information see issue #1496 at https://github.com/progit/progit2/issues/1496."
exit(127)
puts 'Converting to Mobi (kf8)...'
`bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc`
puts ' -- Mobi output at progit.mobi'
end

desc 'build PDF format'
Expand Down Expand Up @@ -126,7 +117,7 @@ namespace :book do
begin
puts 'Removing downloaded and generated files'

FileList[locale_file, 'book/contributors.txt', 'progit.html', 'progit.epub', 'progit.pdf'].each do |file|
FileList[locale_file, 'book/contributors.txt', 'progit.html', 'progit.epub', 'progit.pdf', 'progit.mobi'].each do |file|
rm file
rescue Errno::ENOENT
end
Expand Down

0 comments on commit 7972295

Please sign in to comment.