Skip to content

Commit 86410db

Browse files
committed
Добавлена поддержка формата FB2
1 parent 445ba51 commit 86410db

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release from master
33
on:
44
push:
55
branches: [ master ]
6-
6+
77
workflow_dispatch:
88

99
jobs:
@@ -28,14 +28,14 @@ jobs:
2828
with:
2929
ruby-version: 2.7
3030
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31-
31+
3232
- name: Build release assets
3333
run: bundle exec rake book:build
34-
34+
3535
- name: Create Release
3636
uses: ncipollo/release-action@v1
3737
with:
3838
token: ${{ secrets.GITHUB_TOKEN }}
3939
tag: ${{ steps.compute-tag.outputs.tagname }}
4040
commit: master
41-
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'
41+
artifacts: './progit.epub,./progit.fb2.zip,./progit.mobi,./progit.pdf,./progit.html'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Gemfile.lock
99
*.pdf
1010
*.pdfmarks
1111
*.epub
12+
*.fb2.zip
1213
*-kf8.epub
1314
*.mobi
1415
contributors.txt

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ gem 'asciidoctor', '2.0.17'
66
gem 'json', '2.6.2'
77
gem 'awesome_print', '1.9.2'
88

9+
gem 'asciidoctor-fb2', '0.7.0'
910
gem 'asciidoctor-epub3', '1.5.1'
1011
gem 'asciidoctor-pdf', '2.0.8'
1112

README.asc

Lines changed: 9 additions & 1 deletion
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 FB2...
45+
-- FB2 output at progit.fb2.zip
4446
Converting to Mobi (kf8)...
4547
-- Mobi output at progit.mobi
4648
Converting to PDF...
@@ -63,7 +65,7 @@ Messages: 0 fatals / 0 errors / 0 warnings / 0 infos
6365
EPUBCheck completed
6466
----
6567

66-
Здесь используются проекты `asciidoctor`, `asciidoctor-pdf` и `asciidoctor-epub`.
68+
Здесь используются проекты `asciidoctor`, `asciidoctor-pdf`, `asciidoctor-fb2` и `asciidoctor-epub`.
6769

6870
По умолчанию, `bundle install` устанавливает зависимости глобально в систему.
6971
Чтобы этого избежать, в примере выше менеджер пакетов дополнительно конфигурируется перед установкой зависимостей с помощью следующей команды:
@@ -86,6 +88,12 @@ bundle exec rake book:build_html
8688
bundle exec rake book:build_epub
8789
----
8890

91+
Для генерации только FB2 файла:
92+
93+
----
94+
bundle exec rake book:build_fb2
95+
----
96+
8997
Для генерации только PDF файла:
9098

9199
----

Rakefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace :book do
3939

4040
# Tasks list
4141
desc 'build basic book formats'
42-
task :build => [:build_html, :build_epub, :build_mobi, :build_pdf] do
42+
task :build => [:build_html, :build_epub, :build_fb2, :build_mobi, :build_pdf] do
4343
begin
4444
puts 'Validating generated files...'
4545
Rake::Task['book:check'].invoke
@@ -72,6 +72,15 @@ namespace :book do
7272
puts ' -- EPUB output at progit.epub'
7373
end
7474

75+
desc 'build FB2 format'
76+
task :build_fb2 do
77+
Rake::Task['book:prebuild'].invoke(96)
78+
79+
puts 'Converting to FB2...'
80+
`bundle exec asciidoctor-fb2 #{params} progit.asc`
81+
puts ' -- FB2 output at progit.fb2.zip'
82+
end
83+
7584
desc 'build Mobi format'
7685
task :build_mobi do
7786
Rake::Task['book:prebuild'].invoke(96)
@@ -118,7 +127,7 @@ namespace :book do
118127
begin
119128
puts 'Removing downloaded and generated files'
120129

121-
FileList[locale_file, 'book/contributors.txt', 'progit.html', 'progit.epub', 'progit.pdf', 'progit.mobi'].each do |file|
130+
FileList[locale_file, 'book/contributors.txt', 'progit.html', 'progit.epub', 'progit.fb2.zip' 'progit.pdf', 'progit.mobi'].each do |file|
122131
rm file
123132
rescue Errno::ENOENT
124133
end

0 commit comments

Comments
 (0)