asciidoctor-fb2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c8d4c3a2aa4774098306334ce565317f632d1a18915560dd25df96ce059fa24d
4
+ data.tar.gz: fe4bc5213b9009120a250db9ef89db70c5c312a09f57ee3b74bf11f68a4ed180
5
+ SHA512:
6
+ metadata.gz: 2d9cc6fa6b74be5c852752a2836d0a1607a0d3baeefbeb4047565e2a2b4b68cc7098250a6ad359c58456d55fbf025bcad4c6e0da5f1ad7eb8ba28fccaceebb92
7
+ data.tar.gz: d1ba09be9557da949cccef970a09efdd4a78003b8e3f1d726293da17d69d08435f31f9eeab9e96650cb0c37f962f11d4eea20b05e7f0fb787b2a8b10feac460e
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
@@ -0,0 +1 @@
1
+ *.rb eol=lf
@@ -0,0 +1,8 @@
1
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2
+
3
+ version: 2
4
+ updates:
5
+ - package-ecosystem: "bundler"
6
+ directory: "/"
7
+ schedule:
8
+ interval: "daily"
@@ -0,0 +1,34 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ jobs:
4
+ lint:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - name: Checkout
8
+ uses: actions/checkout@v2
9
+ - name: Set up Ruby
10
+ uses: ruby/setup-ruby@v1
11
+ with:
12
+ ruby-version: 2.7
13
+ - name: Build
14
+ run: bundle install --jobs 4 --retry 3
15
+ - name: Lint
16
+ run: bundle exec rake lint
17
+ test:
18
+ strategy:
19
+ matrix:
20
+ # ruby: [jruby, 2.4, 2.5, 2.6, 2.7]
21
+ ruby: [2.4, 2.5, 2.6, 2.7]
22
+ platform: [ubuntu-latest, macos-latest, windows-latest]
23
+ runs-on: ${{ matrix.platform }}
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@v2
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ - name: Build
32
+ run: bundle install --jobs 4 --retry 3
33
+ - name: Test
34
+ run: bundle exec rake spec
@@ -0,0 +1,24 @@
1
+ name: Publish to RubyGems.org
2
+ on:
3
+ push:
4
+ tags:
5
+ - '*'
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.7
15
+ - name: Publish to RubyGems.org
16
+ run: |
17
+ mkdir -p $HOME/.gem
18
+ touch $HOME/.gem/credentials
19
+ chmod 0600 $HOME/.gem/credentials
20
+ printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
21
+ gem build *.gemspec
22
+ gem push *.gem
23
+ env:
24
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
@@ -0,0 +1,3 @@
1
+ /.bundle/
2
+ /.idea/
3
+ /Gemfile.lock
@@ -0,0 +1,12 @@
1
+ = {project-name} Changelog
2
+ :project-name: Asciidoctor FB2
3
+ :project-handle: asciidoctor-fb2
4
+ :slug: slonopotamus/{project-handle}
5
+ :uri-project: https://github.com/{slug}
6
+
7
+ This document provides a high-level view of the changes to the {project-name} by release.
8
+ For a detailed view of what has changed, refer to the {uri-project}/commits/master[commit history] on GitHub.
9
+
10
+ == 0.1.0 (2020-07-24) - @slonopotamus
11
+
12
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Marat Radchenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ = {project-name}
2
+ Marat Radchenko <marat@slonopotamus.org>
3
+ :project-name: Asciidoctor FB2
4
+ :project-handle: asciidoctor-fb2
5
+ :slug: slonopotamus/{project-handle}
6
+ :uri-project: https://github.com/{slug}
7
+ :uri-ci: {uri-project}/actions?query=branch%3Amaster
8
+ :uri-gem: https://rubygems.org/gems/{project-handle}
9
+
10
+ image:https://img.shields.io/gem/v/{project-handle}.svg[Latest Release,link={uri-gem}]
11
+ image:{uri-project}/workflows/CI/badge.svg?branch=master[Build Status,link={uri-ci}]
12
+
13
+ {project-name} is an Asciidoctor extension for converting AsciiDoc documents directly to the FB2 e-book format.
14
+
15
+ == Installation
16
+
17
+ [source,shell script]
18
+ ----
19
+ $ gem install asciidoctor-fb2 --pre
20
+ ----
21
+
22
+ == Usage
23
+
24
+ [source,shell script]
25
+ ----
26
+ asciidoctor-fb2 /path/to/book.adoc
27
+ ----
28
+
29
+ == Development
30
+
31
+ After checking out the repo, run `bundle install` to install dependencies.
32
+ Then, run `bundle exec rake spec` to run the tests.
33
+
34
+ === FB2-related AsciiDoc Attributes
35
+
36
+ The metadata in the generated FB2 file is populated from attributes in the AsciiDoc document.
37
+ The names of the attributes and the metadata elements to which they map are documented in this section.
38
+
39
+ .AsciiDoc attributes that control the FB2 metadata
40
+ [cols="1m,3"]
41
+ |===
42
+ |Name |Description
43
+
44
+ |uuid
45
+ |Populates unique book identifier in FB2 metadata.
46
+
47
+ |lang
48
+ |Populates the content language in FB2 metadata.
49
+
50
+ |keywords
51
+ |Populates keywords list in FB2 metadata
52
+ The keywords should be represented as comma-separated values (CSV).
53
+
54
+ |genres
55
+ |Populates genres list in FB2 metadata
56
+ The genres should be represented as comma-separated values (CSV).
57
+ |===
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ $default_tasks = [] # rubocop:disable Style/GlobalVars
4
+ Dir.glob('tasks/*.rake').each { |file| load file }
5
+ task default: $default_tasks unless $default_tasks.empty? # rubocop:disable Style/GlobalVars
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/asciidoctor_fb2/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'asciidoctor-fb2'
7
+ s.version = Asciidoctor::FB2::VERSION
8
+ s.authors = ['Marat Radchenko']
9
+ s.email = ['marat@slonopotamus.org']
10
+ s.summary = 'Converts AsciiDoc documents to FB2 e-book formats'
11
+ s.homepage = 'https://github.com/slonopotamus/asciidoctor-fb2'
12
+ s.license = 'MIT'
13
+ s.required_ruby_version = '>= 2.4.0'
14
+
15
+ s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^spec/}) }
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
17
+ File.basename(f)
18
+ end
19
+ s.require_paths = ['lib']
20
+
21
+ s.add_runtime_dependency 'asciidoctor', '~> 2.0'
22
+ s.add_runtime_dependency 'fb2rb', '~> 0.2.0'
23
+
24
+ s.add_development_dependency 'asciidoctor-diagram', '~> 2.0'
25
+ s.add_development_dependency 'rake', '~> 13.0'
26
+ s.add_development_dependency 'rspec', '~> 3.9.0'
27
+ s.add_development_dependency 'rubocop', '~> 0.88.0'
28
+ s.add_development_dependency 'rubocop-rspec', '~> 1.42.0'
29
+ end
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../lib/asciidoctor_fb2'
5
+ require 'asciidoctor/cli'
6
+
7
+ options = Asciidoctor::Cli::Options.new backend: 'fb2'
8
+
9
+ # FIXME: provide an API in Asciidoctor for sub-components to print version information
10
+ unless ARGV != ['-v'] && (ARGV & ['-V', '--version']).empty?
11
+ require_relative '../lib/asciidoctor_fb2/version'
12
+ $stdout.write %(Asciidoctor FB2 #{Asciidoctor::FB2::VERSION} using )
13
+ options.print_version
14
+ exit 0
15
+ end
16
+
17
+ # FIXME: This is a really bizarre API. Please make me simpler.
18
+ case (result = options.parse! ARGV)
19
+ when Integer
20
+ exit result
21
+ else
22
+ invoker = Asciidoctor::Cli::Invoker.new options
23
+ GC.start
24
+ invoker.invoke!
25
+ exit invoker.code
26
+ end
@@ -0,0 +1,326 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'asciidoctor'
4
+ require 'asciidoctor/converter'
5
+ require 'fb2rb'
6
+
7
+ module Asciidoctor
8
+ module FB2
9
+ # Converts AsciiDoc documents to FB2 e-book formats
10
+ class Converter < Asciidoctor::Converter::Base # rubocop:disable Metrics/ClassLength
11
+ include ::Asciidoctor::Writer
12
+
13
+ CSV_DELIMITER_REGEX = /\s*,\s*/.freeze
14
+
15
+ register_for 'fb2'
16
+
17
+ # @return [FB2rb::Book]
18
+ attr_reader(:book)
19
+
20
+ def initialize(backend, opts = {})
21
+ super
22
+ outfilesuffix '.fb2.zip'
23
+ end
24
+
25
+ # @param node [Asciidoctor::Document]
26
+ def convert_document(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
27
+ @book = FB2rb::Book.new
28
+ document_info = @book.description.document_info
29
+ title_info = @book.description.title_info
30
+
31
+ title_info.book_title = node.doctitle
32
+ title_info.lang = node.attr('lang', 'en')
33
+ (node.attr 'keywords', '').split(CSV_DELIMITER_REGEX).each do |s|
34
+ title_info.keywords << s
35
+ end
36
+ (node.attr 'genres', '').split(CSV_DELIMITER_REGEX).each do |s|
37
+ title_info.genres << s
38
+ end
39
+ node.authors.each do |author|
40
+ title_info.authors << FB2rb::Author.new(
41
+ author.firstname,
42
+ author.middlename,
43
+ author.lastname,
44
+ nil,
45
+ [],
46
+ author.email.nil? ? [] : [author.email]
47
+ )
48
+ end
49
+
50
+ if node.attr? 'series-name'
51
+ series_name = node.attr 'series-name'
52
+ series_volume = node.attr 'series-volume', 1
53
+ title_info.sequences << FB2rb::Sequence.new(series_name, series_volume)
54
+ end
55
+
56
+ date = node.attr('revdate') || node.attr('docdate')
57
+ fb2date = FB2rb::FB2Date.new(date, Date.parse(date))
58
+ title_info.date = document_info.date = fb2date
59
+
60
+ document_info.id = node.attr('uuid', '')
61
+ document_info.version = node.attr('revnumber')
62
+ document_info.program_used = %(Asciidoctor FB2 #{VERSION} using Asciidoctor #{node.attr('asciidoctor-version')})
63
+
64
+ publisher = node.attr('publisher')
65
+ document_info.publishers << publisher if publisher
66
+
67
+ body = %(<section>
68
+ <title><p>#{node.doctitle}</p></title>
69
+ #{node.content}
70
+ </section>)
71
+ @book.bodies << FB2rb::Body.new(nil, body)
72
+ if node.document.footnotes
73
+ notes = []
74
+ node.document.footnotes.each do |footnote|
75
+ notes << %(<section id="note-#{footnote.index}">
76
+ <title><p>#{footnote.index}</p></title>
77
+ <p>#{footnote.text}</p>
78
+ </section>)
79
+ end
80
+ @book.bodies << FB2rb::Body.new('notes', notes * "\n")
81
+ end
82
+ @book
83
+ end
84
+
85
+ # @param node [Asciidoctor::Section]
86
+ def convert_preamble(node)
87
+ mark_last_paragraph(node)
88
+ node.content
89
+ end
90
+
91
+ # @param node [Asciidoctor::Section]
92
+ def convert_section(node)
93
+ mark_last_paragraph(node)
94
+ if node.parent == node.document && node.document.doctype == 'book'
95
+ %(<section id="#{node.id}">
96
+ <title><p>#{node.title}</p></title>
97
+ #{node.content}
98
+ </section>)
99
+ else
100
+ %(<subtitle id="#{node.id}">#{node.title}</subtitle>
101
+ #{node.content})
102
+ end
103
+ end
104
+
105
+ # @param node [Asciidoctor::Block]
106
+ def convert_paragraph(node)
107
+ lines = [
108
+ '<p>',
109
+ node.content,
110
+ '</p>'
111
+ ]
112
+ lines << '<empty-line/>' unless node.has_role?('last')
113
+ lines * "\n"
114
+ end
115
+
116
+ # @param node [Asciidoctor::Block]
117
+ def convert_listing(node)
118
+ lines = []
119
+ node.content.split("\n").each do |line|
120
+ lines << %(<p><code>#{line}</code></p>)
121
+ end
122
+ lines << '<empty-line/>' unless node.has_role?('last')
123
+ lines * "\n"
124
+ end
125
+
126
+ (QUOTE_TAGS = { # rubocop:disable Style/MutableConstant
127
+ monospaced: ['<code>', '</code>'],
128
+ emphasis: ['<emphasis>', '</emphasis>'],
129
+ strong: ['<strong>', '</strong>'],
130
+ double: ['“', '”'],
131
+ single: ['‘', '’'],
132
+ superscript: ['<sup>', '</sup>'],
133
+ subscript: ['<sub>', '</sub>'],
134
+ asciimath: ['<code>', '</code>'],
135
+ latexmath: ['<code>', '</code>']
136
+ }).default = ['', '']
137
+
138
+ # @param node [Asciidoctor::Inline]
139
+ def convert_inline_quoted(node)
140
+ open, close = QUOTE_TAGS[node.type]
141
+ %(#{open}#{node.text}#{close})
142
+ end
143
+
144
+ # @param node [Asciidoctor::Inline]
145
+ def convert_inline_anchor(node) # rubocop:disable Metrics/MethodLength
146
+ case node.type
147
+ when :xref
148
+ %(<a l:href="#{node.target}">#{node.text}</a>)
149
+ when :link
150
+ %(<a l:href="#{node.target}">#{node.text}</a>)
151
+ when :ref
152
+ %(<a id="#{node.id}"></a>)
153
+ when :bibref
154
+ unless (reftext = node.reftext)
155
+ reftext = %([#{node.id}])
156
+ end
157
+ %(<a id="#{node.id}"></a>#{reftext})
158
+ else
159
+ logger.warn %(unknown anchor type: #{node.type.inspect})
160
+ nil
161
+ end
162
+ end
163
+
164
+ # @param node [Asciidoctor::Inline]
165
+ def convert_inline_footnote(node)
166
+ index = node.attr('index')
167
+ %(<a l:href="#note-#{index}" type="note">[#{index}]</a>)
168
+ end
169
+
170
+ # @param node [Asciidoctor::Inline]
171
+ def convert_inline_image(node)
172
+ image_attrs = resolve_image_attrs(node, node.target)
173
+ %(<image #{image_attrs * ' '}/>)
174
+ end
175
+
176
+ # @param node [Asciidoctor::Block]
177
+ def convert_image(node)
178
+ image_attrs = resolve_image_attrs(node, node.attr('target'))
179
+ image_attrs << %(title="#{node.captioned_title}") if node.title?
180
+ image_attrs << %(id="#{node.id}") if node.id
181
+ %(<p><image #{image_attrs * ' '}/></p>)
182
+ end
183
+
184
+ # @param doc [Asciidoctor::Document]
185
+ # @return [Asciidoctor::Document]
186
+ def root_document(doc)
187
+ doc = doc.parent_document until doc.parent_document.nil?
188
+ doc
189
+ end
190
+
191
+ # @param node [Asciidoctor::AbstractNode]
192
+ # @param target [String]
193
+ def resolve_image_attrs(node, target) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
194
+ target = node.image_uri(target)
195
+ unless Asciidoctor::Helpers.uriish?(target)
196
+ out_dir = node.attr('outdir', nil, true) || doc_option(node.document, :to_dir)
197
+ fs_path = File.join(out_dir, target)
198
+ unless File.readable?(fs_path)
199
+ base_dir = root_document(node.document).base_dir
200
+ fs_path = File.join(base_dir, target)
201
+ end
202
+
203
+ if File.readable?(fs_path)
204
+ @book.add_binary(target, fs_path)
205
+ target = %(##{target})
206
+ end
207
+ end
208
+
209
+ image_attrs = [%(l:href="#{target}")]
210
+ image_attrs << %(alt="#{node.attr('alt')}") if node.attr? 'alt'
211
+ end
212
+
213
+ # @param node [Asciidoctor::Block]
214
+ def convert_admonition(node)
215
+ %(<p><strong>#{node.title || node.caption}:</strong>
216
+ #{node.content}
217
+ </p>)
218
+ end
219
+
220
+ # @param node [Asciidoctor::List]
221
+ def convert_ulist(node)
222
+ lines = []
223
+ node.items.each do |item|
224
+ lines << %(<p>• #{item.text}</p>)
225
+ lines << %(<p>#{item.content}</p>) if item.blocks?
226
+ end
227
+ lines << '<empty-line/>' unless node.has_role?('last')
228
+ lines * "\n"
229
+ end
230
+
231
+ # @param node [Asciidoctor::List]
232
+ def convert_olist(node)
233
+ lines = []
234
+ node.items.each_with_index do |item, index|
235
+ lines << %(<p>#{index + 1}. #{item.text}</p>)
236
+ lines << %(<p>#{item.content}</p>) if item.blocks?
237
+ end
238
+ lines << '<empty-line/>' unless node.has_role?('last')
239
+ lines * "\n"
240
+ end
241
+
242
+ # @param node [Asciidoctor::List]
243
+ def convert_dlist(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
244
+ lines = ['<table>']
245
+ node.items.each do |terms, dd|
246
+ lines << '<tr>'
247
+ lines << '<td>'
248
+ first_term = true
249
+ terms.each do |dt|
250
+ lines << %(<empty-line/>) unless first_term
251
+ lines << '<p>'
252
+ lines << '<strong>' if node.option?('strong')
253
+ lines << dt.text
254
+ lines << '</strong>' if node.option?('strong')
255
+ lines << '</p>'
256
+ first_term = false
257
+ end
258
+ lines << '</td>'
259
+ lines << '<td>'
260
+ if dd
261
+ lines << %(<p>#{dd.text}</p>) if dd.text?
262
+ lines << dd.content if dd.blocks?
263
+ end
264
+ lines << '</td>'
265
+ lines << '</tr>'
266
+ end
267
+ lines << '</table>'
268
+ lines << '<empty-line/>' unless node.has_role?('last')
269
+ lines * "\n"
270
+ end
271
+
272
+ # @param node [Asciidoctor::Table]
273
+ def convert_table(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
274
+ lines = ['<table>']
275
+ node.rows.to_h.each do |tsec, rows| # rubocop:disable Metrics/BlockLength
276
+ next if rows.empty?
277
+
278
+ rows.each do |row|
279
+ lines << '<tr>'
280
+ row.each do |cell|
281
+ cell_content = if tsec == :head
282
+ cell.text
283
+ else
284
+ case cell.style
285
+ when :asciidoc
286
+ cell.content
287
+ when :literal
288
+ %(<p><pre>#{cell.text}</pre></p>)
289
+ else
290
+ (cell_content = cell.content).empty? ? '' : %(<p>#{cell_content.join "</p>\n<p>"}</p>)
291
+ end
292
+ end
293
+
294
+ cell_tag_name = (tsec == :head || cell.style == :header ? 'th' : 'td')
295
+ cell_attrs = [
296
+ %(halign="#{cell.attr 'halign'}"),
297
+ %(valign="#{cell.attr 'valign'}")
298
+ ]
299
+ cell_attrs << %(colspan="#{cell.colspan}") if cell.colspan
300
+ cell_attrs << %(rowspan="#{cell.rowspan}") if cell.rowspan
301
+ lines << %(<#{cell_tag_name} #{cell_attrs * ' '}">#{cell_content}</#{cell_tag_name}>)
302
+ end
303
+ lines << '</tr>'
304
+ end
305
+ end
306
+ lines << '</table>'
307
+ lines << '<empty-line/>' unless node.has_role?('last')
308
+ lines * "\n"
309
+ end
310
+
311
+ # @param root [Asciidoctor::AbstractNode]
312
+ def mark_last_paragraph(root)
313
+ return unless (last_block = root.blocks[-1])
314
+
315
+ last_block = last_block.blocks[-1] while last_block.context == :section && last_block.blocks?
316
+ last_block.add_role('last') if last_block.context == :paragraph
317
+ nil
318
+ end
319
+
320
+ # @param output [FB2rb::Book]
321
+ def write(output, target)
322
+ output.write(target)
323
+ end
324
+ end
325
+ end
326
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Asciidoctor
4
+ module FB2
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+
5
+ $default_tasks << :build # rubocop:disable Style/GlobalVars
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rake/clean'
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Open an irb session preloaded with this library'
4
+ task :console do
5
+ sh 'bundle console', verbose: false
6
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new :spec do |t|
6
+ t.verbose = true
7
+ opts = %w[-f progress]
8
+ opts.append '-t', '~visual', '-t', '~cli' if ENV['UNIT']
9
+ opts.unshift '-w' if $VERBOSE || ENV['COVERAGE']
10
+ t.rspec_opts = opts
11
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop/rake_task'
4
+
5
+ RuboCop::RakeTask.new :lint do |t|
6
+ t.patterns = Dir['lib/*.rb'] + %w[Rakefile Gemfile tasks/*.rake spec/*.rb]
7
+ end
metadata ADDED
@@ -0,0 +1,162 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asciidoctor-fb2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marat Radchenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-07-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: asciidoctor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fb2rb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: asciidoctor-diagram
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.9.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.9.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.88.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.88.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.42.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.42.0
111
+ description:
112
+ email:
113
+ - marat@slonopotamus.org
114
+ executables:
115
+ - asciidoctor-fb2
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".editorconfig"
120
+ - ".gitattributes"
121
+ - ".github/dependabot.yml"
122
+ - ".github/workflows/ci.yml"
123
+ - ".github/workflows/release.yml"
124
+ - ".gitignore"
125
+ - CHANGELOG.adoc
126
+ - Gemfile
127
+ - LICENSE.txt
128
+ - README.adoc
129
+ - Rakefile
130
+ - asciidoctor-fb2.gemspec
131
+ - bin/asciidoctor-fb2
132
+ - lib/asciidoctor_fb2.rb
133
+ - lib/asciidoctor_fb2/version.rb
134
+ - tasks/bundler.rake
135
+ - tasks/clean.rake
136
+ - tasks/console.rake
137
+ - tasks/rspec.rake
138
+ - tasks/rubocop.rake
139
+ homepage: https://github.com/slonopotamus/asciidoctor-fb2
140
+ licenses:
141
+ - MIT
142
+ metadata: {}
143
+ post_install_message:
144
+ rdoc_options: []
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: 2.4.0
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubygems_version: 3.1.2
159
+ signing_key:
160
+ specification_version: 4
161
+ summary: Converts AsciiDoc documents to FB2 e-book formats
162
+ test_files: []