epub-parser 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +2 -1
- data/README.adoc +2 -1
- data/Steepfile +27 -0
- data/bin/epubinfo +1 -1
- data/epub-parser.gemspec +2 -2
- data/lib/epub/parser/version.rb +1 -1
- data/sig/epub-parser.rbs +425 -0
- metadata +9 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5267c2c665a4fd1fe119e59ed905fdafee49e4f68f063750d80260424ef26ccc
|
4
|
+
data.tar.gz: 3d79ee849a6a7da2e0ac424e6aa5ef272beda4544af29e909f432fabb0f7d402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eda5efdf8d48603ffe69b135011bbd8156d1dff9c78794971d2250162069d5e1b18f0ff579d7324511656df26e0202302c1ce991421eee0c286ad8c6104b6f92
|
7
|
+
data.tar.gz: 7f73b72cb0b7b7fc77c783ce643bd58fc99cf2644497c8eced82f002c412825025a1515a923f6b8a7bd7b7a4d76bc6335c5d520fa0176313cef9daa61529d400
|
data/CHANGELOG.adoc
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
== 0.4.7
|
4
4
|
|
5
|
-
*
|
5
|
+
* [BUG FIX]Fix a bug that epubinfo doesn't handle navigation properly
|
6
6
|
|
7
7
|
== 0.4.6
|
8
8
|
|
9
9
|
* [BUG FIX]Prevent epubinfo tool raise exception when no nav elements
|
10
10
|
* Tiny modifcation on Zip archive manipulation
|
11
|
+
* Remove version specification from Nokogiri to migrate to Ruby 3.1
|
11
12
|
|
12
13
|
== 0.4.5
|
13
14
|
|
data/README.adoc
CHANGED
@@ -178,12 +178,13 @@ If you find other gems, please tell me or request a pull request.
|
|
178
178
|
|
179
179
|
=== 0.4.7
|
180
180
|
|
181
|
-
*
|
181
|
+
* [BUG FIX]Fix a bug that epubinfo doesn't handle navigation properly
|
182
182
|
|
183
183
|
=== 0.4.6
|
184
184
|
|
185
185
|
* [BUG FIX]Prevent epubinfo tool raise exception when no nav elements
|
186
186
|
* Tiny modifcation on Zip archive manipulation
|
187
|
+
* Remove version specification from Nokogiri to migrate to Ruby 3.1
|
187
188
|
|
188
189
|
=== 0.4.5
|
189
190
|
|
data/Steepfile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# D = Steep::Diagnostic
|
2
|
+
#
|
3
|
+
# target :lib do
|
4
|
+
# signature "sig"
|
5
|
+
#
|
6
|
+
# check "lib" # Directory name
|
7
|
+
# check "Gemfile" # File name
|
8
|
+
# check "app/models/**/*.rb" # Glob
|
9
|
+
# # ignore "lib/templates/*.rb"
|
10
|
+
#
|
11
|
+
# # library "pathname", "set" # Standard libraries
|
12
|
+
# # library "strong_json" # Gems
|
13
|
+
#
|
14
|
+
# # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
|
15
|
+
# # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
|
16
|
+
# # configure_code_diagnostics do |hash| # You can setup everything yourself
|
17
|
+
# # hash[D::Ruby::NoMethod] = :information
|
18
|
+
# # end
|
19
|
+
# end
|
20
|
+
|
21
|
+
# target :test do
|
22
|
+
# signature "sig", "sig-private"
|
23
|
+
#
|
24
|
+
# check "test"
|
25
|
+
#
|
26
|
+
# # library "pathname", "set" # Standard libraries
|
27
|
+
# end
|
data/bin/epubinfo
CHANGED
@@ -66,7 +66,7 @@ data['modified'] = book.modified
|
|
66
66
|
data['unique identifier'] = book.metadata.unique_identifier
|
67
67
|
data['epub version'] = book.package.version
|
68
68
|
nav = book.manifest.navs.first
|
69
|
-
data["navigations"] = nav ? nav
|
69
|
+
data["navigations"] = nav ? nav&.content_document&.navigations&.collect(&:type)&.join(", ") : []
|
70
70
|
|
71
71
|
data.each_pair do |(key, value)|
|
72
72
|
data[key] = value.respond_to?(:join) ? value.join(", ") : value.to_s
|
data/epub-parser.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
|
28
28
|
s.add_development_dependency 'rake'
|
29
29
|
s.add_development_dependency 'rubygems-tasks'
|
30
|
-
s.add_development_dependency 'zipruby' unless RUBY_PLATFORM.match /mingw/
|
30
|
+
s.add_development_dependency 'zipruby' unless RUBY_PLATFORM.match /mingw|arm64-darwin/
|
31
31
|
s.add_development_dependency 'pry'
|
32
32
|
s.add_development_dependency 'pry-doc'
|
33
33
|
s.add_development_dependency 'test-unit'
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_development_dependency 'simplecov'
|
37
37
|
s.add_development_dependency 'yard'
|
38
38
|
s.add_development_dependency 'gem-man'
|
39
|
-
s.add_development_dependency 'ronn'
|
39
|
+
s.add_development_dependency 'ronn-ng'
|
40
40
|
s.add_development_dependency 'pretty_backtrace'
|
41
41
|
s.add_development_dependency 'epub-maker'
|
42
42
|
s.add_development_dependency 'asciidoctor'
|
data/lib/epub/parser/version.rb
CHANGED
data/sig/epub-parser.rbs
ADDED
@@ -0,0 +1,425 @@
|
|
1
|
+
# TypeProf 0.21.3
|
2
|
+
|
3
|
+
# Revealed types
|
4
|
+
# /Users/kitaitimakoto/.gem/ruby/3.1.3/gems/nokogiri-1.13.10-arm64-darwin/lib/nokogiri/html4/element_description_defaults.rb:570 #=> String
|
5
|
+
|
6
|
+
# Classes
|
7
|
+
module EPUB
|
8
|
+
NAMESPACES: Hash[String, String]
|
9
|
+
|
10
|
+
module Inspector
|
11
|
+
INSTANCE_VARIABLES_OPTION: {exclude: Array[untyped]}
|
12
|
+
SIMPLE_TEMPLATE: String
|
13
|
+
|
14
|
+
def inspect_simply: -> String
|
15
|
+
def inspect_object_id: -> String
|
16
|
+
def inspect_instance_variables: (?Hash[untyped, untyped] options) -> untyped
|
17
|
+
|
18
|
+
module PublicationModel
|
19
|
+
def self.included: (untyped mod) -> untyped
|
20
|
+
def inspect: -> String
|
21
|
+
def template: -> String
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class OCF
|
26
|
+
MODULES: [String, String, String, String, String, String]
|
27
|
+
|
28
|
+
attr_accessor book: Book | Book::Features
|
29
|
+
|
30
|
+
class PhysicalContainer
|
31
|
+
self.@adapter: :UnpackedDirectory | :UnpackedURI | singleton(ArchiveZip) | singleton(UnpackedDirectory)
|
32
|
+
@container_path: String | URI::Generic
|
33
|
+
@monitor: Monitor
|
34
|
+
|
35
|
+
def self.find_adapter: (:UnpackedDirectory | :UnpackedURI | singleton(ArchiveZip) | singleton(UnpackedDirectory) adapter) -> (:UnpackedDirectory | :UnpackedURI | singleton(ArchiveZip) | singleton(UnpackedDirectory))
|
36
|
+
def self.adapter: -> (:UnpackedDirectory | :UnpackedURI | singleton(ArchiveZip) | singleton(UnpackedDirectory))
|
37
|
+
def self.adapter=: (:UnpackedDirectory | :UnpackedURI | singleton(ArchiveZip) | singleton(UnpackedDirectory) adapter) -> (:UnpackedDirectory | :UnpackedURI | singleton(ArchiveZip) | singleton(UnpackedDirectory))
|
38
|
+
def self.open: (String container_path) { (IO | UnpackedDirectory) -> (Parser::OCF | String) } -> String
|
39
|
+
def self.read: (String container_path, String path_name) -> String
|
40
|
+
def self._adapter: -> ((:UnpackedDirectory | :UnpackedURI | singleton(ArchiveZip) | singleton(PhysicalContainer) | singleton(UnpackedDirectory))?)
|
41
|
+
def initialize: (String | URI::Generic container_path) -> void
|
42
|
+
|
43
|
+
class ArchiveZip < PhysicalContainer
|
44
|
+
@entries: Hash[untyped, untyped]
|
45
|
+
@last_iterated_entry_index: Integer
|
46
|
+
@archive: nil
|
47
|
+
|
48
|
+
def initialize: (String container_path) -> void
|
49
|
+
def open: { (UnpackedDirectory) -> String } -> untyped
|
50
|
+
def read: (untyped path_name) -> untyped
|
51
|
+
end
|
52
|
+
|
53
|
+
class UnpackedDirectory < PhysicalContainer
|
54
|
+
def open: ?{ (UnpackedDirectory) -> String } -> String
|
55
|
+
def read: (String path_name) -> String
|
56
|
+
end
|
57
|
+
|
58
|
+
class UnpackedURI < PhysicalContainer
|
59
|
+
def initialize: (String | URI::Generic container_path) -> void
|
60
|
+
def open: -> untyped
|
61
|
+
def read: (String path_name) -> untyped
|
62
|
+
end
|
63
|
+
|
64
|
+
class NoEntry < StandardError
|
65
|
+
def self.from_error: (nil error) -> NoEntry
|
66
|
+
end
|
67
|
+
|
68
|
+
class Zipruby < PhysicalContainer
|
69
|
+
@archive: nil
|
70
|
+
|
71
|
+
def open: ?{ -> untyped } -> untyped
|
72
|
+
def read: (untyped path_name) -> untyped
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
module Publication
|
78
|
+
class Package
|
79
|
+
CONTENT_MODELS: [:metadata, :manifest, :spine, :guide, :bindings]
|
80
|
+
RESERVED_VOCABULARY_PREFIXES: Hash[String, String]
|
81
|
+
include Inspector
|
82
|
+
@metadata: bot
|
83
|
+
|
84
|
+
def self.define_content_model: (:bindings | :guide | :manifest | :metadata | :spine model_name) -> untyped
|
85
|
+
attr_accessor book: Book | Object
|
86
|
+
attr_accessor version: bot
|
87
|
+
attr_accessor prefix: Hash[String, String?]
|
88
|
+
attr_accessor xml_lang: bot
|
89
|
+
attr_accessor dir: bot
|
90
|
+
attr_accessor id: bot
|
91
|
+
alias lang xml_lang
|
92
|
+
alias lang= xml_lang=
|
93
|
+
def initialize: -> void
|
94
|
+
def unique_identifier: -> untyped
|
95
|
+
def rootfile: -> untyped
|
96
|
+
def full_path: -> nil
|
97
|
+
def inspect: -> String
|
98
|
+
def inspect_models: -> String
|
99
|
+
end
|
100
|
+
|
101
|
+
module FixedLayout
|
102
|
+
PREFIX_KEY: String
|
103
|
+
PREFIX_VALUE: String
|
104
|
+
RENDITION_PROPERTIES: Hash[String, Array[String]]
|
105
|
+
|
106
|
+
def self.included: (singleton(Package) package_class) -> [[singleton(Package), singleton(PackageMixin)], [untyped, singleton(MetadataMixin)], [untyped, singleton(ItemrefMixin)], [untyped, singleton(ItemMixin)], [singleton(ContentDocument::XHTML), singleton(ContentDocumentMixin)]]
|
107
|
+
|
108
|
+
class UnsupportedRenditionValue < StandardError
|
109
|
+
end
|
110
|
+
|
111
|
+
module Rendition
|
112
|
+
def def_rendition_methods: -> Array[String]
|
113
|
+
def def_rendition_layout_methods: -> Array[String]
|
114
|
+
end
|
115
|
+
|
116
|
+
module PackageMixin
|
117
|
+
def using_fixed_layout: -> untyped
|
118
|
+
alias using_fixed_layout? using_fixed_layout
|
119
|
+
def using_fixed_layout=: (untyped using_fixed_layout) -> String
|
120
|
+
end
|
121
|
+
|
122
|
+
module MetadataMixin
|
123
|
+
extend Rendition
|
124
|
+
end
|
125
|
+
|
126
|
+
module ItemrefMixin
|
127
|
+
PAGE_SPREAD_PROPERTY: String
|
128
|
+
PAGE_SPREAD_PREFIX: String
|
129
|
+
extend Rendition
|
130
|
+
|
131
|
+
def self.included: (untyped base) -> nil
|
132
|
+
end
|
133
|
+
|
134
|
+
module ItemMixin
|
135
|
+
extend Rendition
|
136
|
+
end
|
137
|
+
|
138
|
+
module ContentDocumentMixin
|
139
|
+
extend Rendition
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
module ContentDocument
|
145
|
+
class XHTML
|
146
|
+
@rexml: untyped
|
147
|
+
@oga: untyped
|
148
|
+
@nokogiri: Nokogiri::XML::Document
|
149
|
+
|
150
|
+
attr_accessor item: untyped
|
151
|
+
def read: (?detect_encoding: true) -> untyped
|
152
|
+
alias raw_document read
|
153
|
+
def top_level?: -> untyped
|
154
|
+
def title: -> String
|
155
|
+
def rexml: -> untyped
|
156
|
+
def oga: -> untyped
|
157
|
+
def nokogiri: -> Nokogiri::XML::Document
|
158
|
+
end
|
159
|
+
|
160
|
+
module Typable
|
161
|
+
attr_reader types: Set[bot]
|
162
|
+
def types: -> Set[bot]
|
163
|
+
def types=: (untyped ts) -> Set[bot]
|
164
|
+
end
|
165
|
+
|
166
|
+
class Navigation < XHTML
|
167
|
+
include Typable
|
168
|
+
@hidden: false
|
169
|
+
@parent: nil
|
170
|
+
|
171
|
+
attr_accessor navigations: Array[untyped]
|
172
|
+
def initialize: -> void
|
173
|
+
def toc: -> nil
|
174
|
+
def page_list: -> nil
|
175
|
+
def landmarks: -> nil
|
176
|
+
def contents: -> Array[untyped]
|
177
|
+
def pages: -> bot
|
178
|
+
def each_content: { -> bot } -> untyped
|
179
|
+
def each_page: -> bot
|
180
|
+
def each_landmark: -> bot
|
181
|
+
def navigation: -> nil
|
182
|
+
|
183
|
+
module Hidable
|
184
|
+
attr_accessor hidden: true?
|
185
|
+
attr_accessor parent: Item | ItemList | Navigation
|
186
|
+
def hidden?: -> bool
|
187
|
+
end
|
188
|
+
|
189
|
+
class Item
|
190
|
+
include Typable
|
191
|
+
include Hidable
|
192
|
+
|
193
|
+
attr_accessor items: ItemList
|
194
|
+
attr_accessor text: nil
|
195
|
+
attr_accessor content_document: untyped
|
196
|
+
attr_accessor item: untyped
|
197
|
+
attr_reader href: untyped
|
198
|
+
def initialize: -> void
|
199
|
+
def href=: (untyped iri) -> untyped
|
200
|
+
def traverse: (?Integer depth) -> ItemList
|
201
|
+
def type: -> nil
|
202
|
+
def type=: (untyped t) -> Set[bot]
|
203
|
+
end
|
204
|
+
|
205
|
+
class Navigation < Item
|
206
|
+
alias navigations items
|
207
|
+
alias navigations= items=
|
208
|
+
alias heading text
|
209
|
+
alias heading= text=
|
210
|
+
|
211
|
+
module Type
|
212
|
+
TOC: String
|
213
|
+
PAGE_LIST: String
|
214
|
+
LANDMARKS: String
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
class ItemList < Array[untyped]
|
219
|
+
include Hidable
|
220
|
+
|
221
|
+
def <<: (Item? item) -> ItemList
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
class Book
|
227
|
+
include Features
|
228
|
+
@adapter: :UnpackedDirectory | :UnpackedURI | singleton(OCF::PhysicalContainer::ArchiveZip) | singleton(OCF::PhysicalContainer::UnpackedDirectory)
|
229
|
+
|
230
|
+
module Features
|
231
|
+
extend Forwardable
|
232
|
+
@adapter: :UnpackedDirectory | :UnpackedURI | singleton(OCF::PhysicalContainer::ArchiveZip) | singleton(OCF::PhysicalContainer::UnpackedDirectory)
|
233
|
+
|
234
|
+
attr_reader ocf: OCF
|
235
|
+
attr_accessor epub_file: String
|
236
|
+
def ocf=: (OCF mod) -> OCF
|
237
|
+
def rootfiles: -> untyped
|
238
|
+
def packages: -> untyped
|
239
|
+
alias renditions packages
|
240
|
+
def default_rendition: -> untyped
|
241
|
+
alias package default_rendition
|
242
|
+
def container_adapter: -> (:UnpackedDirectory | :UnpackedURI | singleton(OCF::PhysicalContainer::ArchiveZip) | singleton(OCF::PhysicalContainer::UnpackedDirectory))
|
243
|
+
def container_adapter=: (:UnpackedDirectory | :UnpackedURI adapter) -> (:UnpackedDirectory | :UnpackedURI | singleton(OCF::PhysicalContainer::ArchiveZip) | singleton(OCF::PhysicalContainer::UnpackedDirectory))
|
244
|
+
def cover_image: -> untyped
|
245
|
+
def each_page_on_spine: ?{ -> untyped } -> untyped
|
246
|
+
def each_page_on_toc: -> untyped
|
247
|
+
def each_content: ?{ -> untyped } -> untyped
|
248
|
+
def other_navigation: -> untyped
|
249
|
+
def resources: -> untyped
|
250
|
+
def rootfile_path: -> untyped
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
module MediaType
|
255
|
+
EPUB: String
|
256
|
+
ROOTFILE: String
|
257
|
+
IMAGE: [String, String, String, String]
|
258
|
+
APPLICATION: [String, String, String, String, String, String]
|
259
|
+
AUDIO: [String, String]
|
260
|
+
TEXT: [String, String]
|
261
|
+
CORE: Array[String]
|
262
|
+
|
263
|
+
class UnsupportedMediaType < StandardError
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
module Type
|
268
|
+
DOCUMENT_NAVIGATION: [String, String]
|
269
|
+
PAGINATION: [String, String]
|
270
|
+
TYPES: Array[String]
|
271
|
+
end
|
272
|
+
|
273
|
+
class Parser
|
274
|
+
VERSION: String
|
275
|
+
@filepath: String
|
276
|
+
@book: Book
|
277
|
+
|
278
|
+
def self.parse: (String filepath, ?container_adapter: :UnpackedDirectory?, ?book: Object?, ?initialize_with: nil, **singleton(MyBook)) -> Book
|
279
|
+
def initialize: (String filepath, ?container_adapter: nil, ?book: nil, ?initialize_with: nil, **untyped) -> void
|
280
|
+
def parse: -> Book
|
281
|
+
|
282
|
+
private
|
283
|
+
def create_book: (?book: nil, ?initialize_with: nil, **untyped) -> Book
|
284
|
+
|
285
|
+
class XMLDocument
|
286
|
+
def self.new: (String? xml) -> Nokogiri::XML::Document
|
287
|
+
end
|
288
|
+
|
289
|
+
module Metadata
|
290
|
+
def parse_metadata: (untyped elem, untyped unique_identifier_id, String default_namespace) -> untyped
|
291
|
+
def build_model: (untyped elem, ?:DCMES | :Identifier | :Link | :Meta | :Title klass, ?Array[String] attributes) -> untyped
|
292
|
+
def build_unsupported_model: (untyped elem) -> untyped
|
293
|
+
end
|
294
|
+
|
295
|
+
class OCF
|
296
|
+
DIRECTORY: String
|
297
|
+
include Metadata
|
298
|
+
@container: (IO | OCF::PhysicalContainer::UnpackedDirectory)?
|
299
|
+
@ocf: OCF
|
300
|
+
|
301
|
+
def self.parse: (IO | OCF::PhysicalContainer::UnpackedDirectory container) -> OCF
|
302
|
+
def initialize: ((IO | OCF::PhysicalContainer::UnpackedDirectory)? container) -> void
|
303
|
+
def parse: -> OCF
|
304
|
+
def parse_container: (String xml) -> untyped
|
305
|
+
def parse_encryption: (String content) -> untyped
|
306
|
+
def parse_manifest: (untyped content) -> nil
|
307
|
+
def parse_metadata: (String content) -> untyped
|
308
|
+
def parse_rights: (untyped content) -> nil
|
309
|
+
def parse_signatures: (untyped content) -> nil
|
310
|
+
|
311
|
+
private
|
312
|
+
def multiple_rendition_metadata?: (Nokogiri::XML::Document doc) -> untyped
|
313
|
+
end
|
314
|
+
|
315
|
+
class Publication
|
316
|
+
include Metadata
|
317
|
+
@doc: Nokogiri::XML::Document
|
318
|
+
|
319
|
+
def self.parse: (IO container, untyped file) -> Publication::Package
|
320
|
+
def initialize: (String? opf) -> void
|
321
|
+
def parse: -> Publication::Package
|
322
|
+
def parse_package: (Nokogiri::XML::Document doc) -> Publication::Package
|
323
|
+
def parse_metadata: (Nokogiri::XML::Document doc) -> untyped
|
324
|
+
def parse_manifest: (Nokogiri::XML::Document doc) -> untyped
|
325
|
+
def parse_spine: (Nokogiri::XML::Document doc) -> untyped
|
326
|
+
def parse_guide: (Nokogiri::XML::Document doc) -> untyped
|
327
|
+
def parse_bindings: (Nokogiri::XML::Document doc, untyped handler_map) -> untyped
|
328
|
+
def parse_prefix: (untyped str) -> Hash[String, String?]
|
329
|
+
end
|
330
|
+
|
331
|
+
class ContentDocument
|
332
|
+
@item: untyped
|
333
|
+
|
334
|
+
def initialize: (untyped item) -> void
|
335
|
+
def parse: -> ((ContentDocument::Navigation | ContentDocument::XHTML)?)
|
336
|
+
def parse_navigations: (Nokogiri::XML::Document document) -> untyped
|
337
|
+
def parse_navigation: (untyped element) -> ContentDocument::Navigation::Navigation
|
338
|
+
def parse_navigation_item: (untyped element) -> ContentDocument::Navigation::Item?
|
339
|
+
|
340
|
+
private
|
341
|
+
def find_heading: (untyped element) -> nil
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
module Searcher
|
346
|
+
def self.search_text: (untyped epub, untyped word, **untyped) -> untyped
|
347
|
+
def self.search_element: (untyped epub, ?css: nil, ?xpath: nil, ?namespaces: Hash[untyped, untyped]) -> Array[untyped]
|
348
|
+
def self.search_by_cfi: (untyped epub, untyped cfi) -> [untyped, untyped]
|
349
|
+
|
350
|
+
class Result
|
351
|
+
def self.aggregate_step_intersection: (untyped steps1, untyped steps2) -> [Array[untyped], Array[untyped], Array[untyped]]
|
352
|
+
attr_reader parent_steps: Array[Step]
|
353
|
+
attr_reader start_steps: Array[Step]?
|
354
|
+
attr_reader end_steps: Array[Step]?
|
355
|
+
def initialize: (Array[Step] parent_steps, Array[Step]? start_steps, Array[Step]? end_steps) -> void
|
356
|
+
def to_cfi: -> untyped
|
357
|
+
def ==: (untyped other) -> bool
|
358
|
+
|
359
|
+
class Step
|
360
|
+
attr_reader type: :character | :element | :itemref | :text
|
361
|
+
attr_reader index: Complex | Float | Integer | Rational
|
362
|
+
attr_reader info: {name: String, id: String?}
|
363
|
+
def initialize: (:character | :element | :itemref | :text `type`, Complex | Float | Integer | Rational index, ?{name: String, id: String?} info) -> void
|
364
|
+
def ==: (untyped other) -> bool
|
365
|
+
def to_cfi: -> String?
|
366
|
+
|
367
|
+
private
|
368
|
+
def id_assertion: -> String?
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
class Publication
|
373
|
+
@package: Publication::Package?
|
374
|
+
|
375
|
+
def self.search_text: (Publication::Package? package, String word, **untyped) -> untyped
|
376
|
+
def self.search_element: (Publication::Package package, ?css: String?, ?xpath: String?, ?namespaces: Hash[String, String]) -> Array[untyped]
|
377
|
+
def self.search_by_cfi: (untyped package, untyped cfi) -> [untyped, untyped]
|
378
|
+
def initialize: (Publication::Package? package) -> void
|
379
|
+
def search_text: (untyped word, ?algorithm: :seamless) -> Array[untyped]
|
380
|
+
def search_element: (?css: String?, ?xpath: String?, ?namespaces: Hash[String, String]) -> Array[untyped]
|
381
|
+
def search_by_cfi: (untyped cfi) -> [untyped, untyped]
|
382
|
+
|
383
|
+
private
|
384
|
+
def find_path: (untyped elem) -> untyped
|
385
|
+
end
|
386
|
+
|
387
|
+
class XHTML
|
388
|
+
ALGORITHMS: Hash[untyped, untyped]
|
389
|
+
@element: Nokogiri::XML::Document
|
390
|
+
|
391
|
+
def self.search_text: (Nokogiri::XML::Document element, String word) -> Array[Result]
|
392
|
+
def initialize: (Nokogiri::XML::Document element) -> void
|
393
|
+
|
394
|
+
class Restricted < XHTML
|
395
|
+
def search_text: (String word, ?nil element) -> Array[untyped]
|
396
|
+
end
|
397
|
+
|
398
|
+
class Seamless < XHTML
|
399
|
+
@indices: Hash[untyped, untyped]?
|
400
|
+
@content: String
|
401
|
+
|
402
|
+
def initialize: (Nokogiri::XML::Document element) -> void
|
403
|
+
def search_text: (String word) -> Array[Result]
|
404
|
+
def build_indices: (Nokogiri::XML::Document element) -> [Hash[untyped, untyped], String]
|
405
|
+
|
406
|
+
private
|
407
|
+
def visit: (Hash[untyped, untyped]? indices, String? content, String word) -> Array[Result]
|
408
|
+
def find_offset: (Array[untyped] offsets, Complex | Float | Integer | Rational index, ?bool for_end_position) -> untyped
|
409
|
+
def to_result_steps: (nil steps) -> untyped
|
410
|
+
end
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
class TestInspect
|
416
|
+
class TestPackage < TestInspect
|
417
|
+
class TestMetadata < TestPackage
|
418
|
+
Metadata: untyped
|
419
|
+
end
|
420
|
+
|
421
|
+
class TestManifest < TestPackage
|
422
|
+
Manifest: untyped
|
423
|
+
end
|
424
|
+
end
|
425
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KITAITI Makoto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: zipruby
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: pry
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,7 +151,7 @@ dependencies:
|
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: '0'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
|
-
name: ronn
|
154
|
+
name: ronn-ng
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
170
156
|
requirements:
|
171
157
|
- - ">="
|
@@ -352,6 +338,7 @@ files:
|
|
352
338
|
- MIT-LICENSE
|
353
339
|
- README.adoc
|
354
340
|
- Rakefile
|
341
|
+
- Steepfile
|
355
342
|
- bin/epub-cover
|
356
343
|
- bin/epub-open
|
357
344
|
- bin/epubinfo
|
@@ -419,6 +406,7 @@ files:
|
|
419
406
|
- lib/epub/searcher/result.rb
|
420
407
|
- lib/epub/searcher/xhtml.rb
|
421
408
|
- man/epubinfo.1.ronn
|
409
|
+
- sig/epub-parser.rbs
|
422
410
|
- test/fixtures/book/META-INF/container.xml
|
423
411
|
- test/fixtures/book/META-INF/metadata.xml
|
424
412
|
- test/fixtures/book/OEBPS/2_chapter-1.xhtml
|
@@ -457,7 +445,7 @@ licenses:
|
|
457
445
|
- MIT
|
458
446
|
metadata:
|
459
447
|
yard.run: yard
|
460
|
-
post_install_message:
|
448
|
+
post_install_message:
|
461
449
|
rdoc_options: []
|
462
450
|
require_paths:
|
463
451
|
- lib
|
@@ -472,8 +460,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
472
460
|
- !ruby/object:Gem::Version
|
473
461
|
version: '0'
|
474
462
|
requirements: []
|
475
|
-
rubygems_version: 3.
|
476
|
-
signing_key:
|
463
|
+
rubygems_version: 3.4.21
|
464
|
+
signing_key:
|
477
465
|
specification_version: 4
|
478
466
|
summary: EPUB 3 Parser
|
479
467
|
test_files:
|