Skip to content

Commit 7972295

Browse files
committed
Добавлена поддержка формата MOBI
1 parent 338d0cc commit 7972295

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
token: ${{ secrets.GITHUB_TOKEN }}
3939
tag: ${{ steps.compute-tag.outputs.tagname }}
4040
comit: master
41-
artifacts: './progit.epub,./progit.pdf,./progit.html'
41+
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'

Gemfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ gem 'asciidoctor', '2.0.12'
66
gem 'json', '2.5.1'
77
gem 'awesome_print', '1.9.2'
88

9-
gem 'asciidoctor-epub3', '1.5.0.alpha.19'
10-
gem 'asciidoctor-pdf', '1.5.4'
9+
gem 'asciidoctor-epub3', '1.5.1'
10+
gem 'asciidoctor-pdf', '1.6.0'
1111

1212
gem 'coderay', '1.1.3'
1313
gem 'pygments.rb', '2.2.0'
1414
gem 'thread_safe', '0.3.6'
15-
gem 'epubcheck-ruby', '4.2.4.0'
16-
gem 'html-proofer', '3.18.8'
15+
gem 'epubcheck-ruby', '4.2.5.0'
16+
gem 'html-proofer', '3.19.2'
17+
gem 'kindlegen', '3.1.1'

README.asc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Converting to HTML...
4141
-- HTML output at progit.html
4242
Converting to EPUB...
4343
-- EPUB output at progit.epub
44+
Converting to Mobi (kf8)...
45+
-- Mobi output at progit.mobi
4446
Converting to PDF...
4547
-- PDF output at progit.pdf
4648
Validating generated files...
@@ -90,6 +92,12 @@ bundle exec rake book:build_epub
9092
bundle exec rake book:build_pdf
9193
----
9294

95+
Для генерации только MOBI файла:
96+
97+
----
98+
bundle exec rake book:build_mobi
99+
----
100+
93101
Для валидации сгенерированных файлов предусмотрены команды проверки.
94102

95103
Для проверки HTML файла:

Rakefile

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace :book do
3838

3939
# Tasks list
4040
desc 'build basic book formats'
41-
task :build => [:build_html, :build_epub, :build_pdf] do
41+
task :build => [:build_html, :build_epub, :build_mobi, :build_pdf] do
4242
begin
4343
puts 'Validating generated files...'
4444
Rake::Task['book:check'].invoke
@@ -75,18 +75,9 @@ namespace :book do
7575
task :build_mobi do
7676
Rake::Task['book:prebuild'].invoke(96)
7777

78-
# Commented out the .mobi file creation because the kindlegen dependency is not available.
79-
# For more information on this see: #1496.
80-
# This is a (hopefully) temporary fix until upstream asciidoctor-epub3 is fixed and we can offer .mobi files again.
81-
82-
# puts "Converting to Mobi (kf8)..."
83-
# `bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc`
84-
# puts " -- Mobi output at progit.mobi"
85-
86-
# FIXME: If asciidoctor-epub3 supports Mobi again, uncomment these lines below
87-
puts "Converting to Mobi isn't supported yet."
88-
puts "For more information see issue #1496 at https://github.com/progit/progit2/issues/1496."
89-
exit(127)
78+
puts 'Converting to Mobi (kf8)...'
79+
`bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc`
80+
puts ' -- Mobi output at progit.mobi'
9081
end
9182

9283
desc 'build PDF format'
@@ -126,7 +117,7 @@ namespace :book do
126117
begin
127118
puts 'Removing downloaded and generated files'
128119

129-
FileList[locale_file, 'book/contributors.txt', 'progit.html', 'progit.epub', 'progit.pdf'].each do |file|
120+
FileList[locale_file, 'book/contributors.txt', 'progit.html', 'progit.epub', 'progit.pdf', 'progit.mobi'].each do |file|
130121
rm file
131122
rescue Errno::ENOENT
132123
end

0 commit comments

Comments
 (0)