epub-translator 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d3a2097137099f87c52a3cfa7358d9ba79d12288631267913371df4ba8e9eb2
4
- data.tar.gz: d212b682ab130cca1d1740946b36f25d0537d22b9f85929aab12895c57980e96
3
+ metadata.gz: 81fb9a83804addbdddeb4bc7972c47e7f477d2f8ea7ca622382ba4060cec69ff
4
+ data.tar.gz: 76a1d414ff2e11a571b8e064a698b190023135afb71265bc3e47449c673f10f3
5
5
  SHA512:
6
- metadata.gz: 051da38c1df90cc5da8a37541dc404906c7a4f45023088cbf3c72c3bf8525d390ca59c470977929a819f31a27d284a6bab4447ba66699c0a9e2ae183d00f5291
7
- data.tar.gz: 7b39119783ac14f4487728fd2bcf5fa6c200bc75f7e38e7c18c8d980fea98947892e2eed104cc182cba46fd322375e6279b4cea70aed09531b747cdd326f0f0d
6
+ metadata.gz: ab7d61acb8b94386d781a26438abd13cf8f33f465905223b64b0088763ecdf477eb4ca4c3eb6d2f877a7135215df78cb8a4849f59091d8cc6329b269b74c7fe2
7
+ data.tar.gz: bd9c05916f0b91e37c0109c6a3a74fcd8d8f7cd86686f2894a1ac6a056259263d50ac1134d6974599be1a79d9f71bddd642cf3c774c7f8a8f8d401c913af27d5
data/CHANGELOG.md CHANGED
@@ -3,3 +3,8 @@
3
3
  ## [0.1.0] - 2022-07-02
4
4
 
5
5
  - Initial release
6
+
7
+ ## [0.1.1] - 2023-02-27
8
+
9
+ - Fix crash if epub document does not have `lang` attribute
10
+ - Skip interlace on nodes if they don't differ
data/README.md CHANGED
@@ -36,18 +36,20 @@ It will generate another EPUB file, with translated paragraphs next to their sou
36
36
 
37
37
  ## Feature
38
38
 
39
- Epub::Translator utilized [Natsukantou](https://gitlab.com/lulalala/natsukantou) gem, which aims to be configurable. For example, it comes with its own glossary middleware, and can handle HTML Ruby Markup. The wizard will ask you which you want to use, but you can read [here](https://gitlab.com/lulalala/natsukantou#middlewares) to learn more about them.
40
-
41
- ### Translators
39
+ Epub::Translator uses [Natsukantou](https://gitlab.com/lulalala/natsukantou) gem for translating XMLs. It uses the middleware pattern to provide customizability, e.g. you can decide whether to flatten HTML Ruby Markup. A wizard will guide you through the configuration process.
42
40
 
43
41
  [List of supported translation services](https://gitlab.com/lulalala/natsukantou#translators)
44
42
 
43
+ [List of middlewares (filters)](https://gitlab.com/lulalala/natsukantou#middlewares)
44
+
45
45
  ## Development
46
46
 
47
47
  The XML related operations are purposefully extracted into its own gem: [Natsukantou](https://gitlab.com/lulalala/natsukantou).
48
48
 
49
49
  This gem uses [Oga XML parser](https://gitlab.com/yorickpeterse/oga) and [epub-parser](https://gitlab.com/KitaitiMakoto/epub-parser) (both hosted on GitLab, yay!).
50
50
 
51
+ The wizard process uses [tty-prompt](https://github.com/piotrmurach/tty-prompt) and [yard](https://github.com/lsegal/yard).
52
+
51
53
  ## Contributing
52
54
 
53
55
  Bug reports and merge requests are welcome on GitLab at https://gitlab.com/lulalala/epub-translator.
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "epub-maker", "~> 0.1.7"
32
32
  spec.add_dependency "epub-parser", "~> 0.4.6"
33
33
  spec.add_dependency "middleware", "~> 0.1.0"
34
- spec.add_dependency "natsukantou", "~> 0.1.2"
34
+ spec.add_dependency "natsukantou", "~> 0.1.3"
35
35
  spec.add_dependency "tty-prompt", "~> 0.23"
36
36
 
37
37
  spec.add_development_dependency "debug", ">= 1.0.0"
@@ -44,8 +44,12 @@ module Epub
44
44
 
45
45
  items = book.each_page_on_spine.select(&:xhtml?)
46
46
  items_untranslated_index = items.map.with_index do |item, index|
47
- lang = Natsukantou::LanguageCode.new(item.content_document.oga.lang)
48
- lang.is?(lang_to) ? nil : index
47
+ if (doc_lang_code = item.content_document.oga.lang)
48
+ lang = Natsukantou::LanguageCode.new(doc_lang_code)
49
+ lang.is?(lang_to) ? nil : index
50
+ else
51
+ index
52
+ end
49
53
  end.compact
50
54
 
51
55
  choices = items.map.with_index do |item, index|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Epub
4
4
  module Translator
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epub-translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - lulalala
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-01 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: epub-maker
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.2
61
+ version: 0.1.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.2
68
+ version: 0.1.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: tty-prompt
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubygems_version: 3.3.7
161
+ rubygems_version: 3.4.6
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Tools to translate EPUB books