coradoc 1.1.7 → 1.1.8
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/lib/coradoc/input/docx.rb +28 -1
- data/lib/coradoc/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa6087920cf2a472b02e4e44bdf3b984f42e99e39d0290c7621d431629e747f2
|
|
4
|
+
data.tar.gz: 1f51521272e4ab8cb514ae1d0dafc7a68f83ecd95637cb7ed0a8c9fdfab7eba4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58a6a02fe1f0f6515da56c238a7068d18148cb91e3e172a2c8bdf7cc3af03363ba6ee4931a67f3d07ec9eaf5135a1d9092109a2c801aa37e516924a9b011be8d
|
|
7
|
+
data.tar.gz: 18ca28c32f330ba3a0457f07e3fd92732f7d91895b555791d5648fa7903f50345cbed89b09fdcb5e6c34537dbddb1ed5ca9c0ea2531044738892ffa9b7fa341c
|
data/lib/coradoc/input/docx.rb
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
require "word-to-markdown"
|
|
2
1
|
require "coradoc/input/html"
|
|
3
2
|
require "fileutils"
|
|
4
3
|
|
|
5
4
|
module Coradoc
|
|
6
5
|
module Input
|
|
7
6
|
module Docx
|
|
7
|
+
WORD_TO_MARKDOWN_MISSING_MSG =
|
|
8
|
+
"DOCX input requires the 'word-to-markdown' gem, " \
|
|
9
|
+
"which is unavailable on this platform. " \
|
|
10
|
+
"See https://github.com/metanorma/coradoc/issues/192".freeze
|
|
11
|
+
|
|
12
|
+
def self.windows_ruby4?
|
|
13
|
+
Gem.win_platform? &&
|
|
14
|
+
Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("4.0")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
WORD_TO_MARKDOWN_AVAILABLE = if windows_ruby4?
|
|
18
|
+
false
|
|
19
|
+
else
|
|
20
|
+
begin
|
|
21
|
+
require "word-to-markdown"
|
|
22
|
+
true
|
|
23
|
+
rescue LoadError
|
|
24
|
+
false
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
8
28
|
def self.processor_id
|
|
9
29
|
:docx
|
|
10
30
|
end
|
|
@@ -13,7 +33,14 @@ module Coradoc
|
|
|
13
33
|
%w[.docx .doc].any? { |i| filename.downcase.end_with?(i) }
|
|
14
34
|
end
|
|
15
35
|
|
|
36
|
+
def self.assert_word_to_markdown!
|
|
37
|
+
return if WORD_TO_MARKDOWN_AVAILABLE
|
|
38
|
+
|
|
39
|
+
raise LoadError, WORD_TO_MARKDOWN_MISSING_MSG
|
|
40
|
+
end
|
|
41
|
+
|
|
16
42
|
def self.processor_execute(input, options = {})
|
|
43
|
+
assert_word_to_markdown!
|
|
17
44
|
image_dir = Dir.mktmpdir
|
|
18
45
|
options = options.merge(sourcedir: image_dir)
|
|
19
46
|
doc = WordToMarkdown.new(input, image_dir)
|
data/lib/coradoc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: coradoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
- Abu Nashir
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: exe
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: base64
|
|
@@ -325,7 +324,6 @@ licenses:
|
|
|
325
324
|
metadata:
|
|
326
325
|
homepage_uri: https://www.metanorma.org
|
|
327
326
|
source_code_uri: https://github.com/metanorma/coradoc
|
|
328
|
-
post_install_message:
|
|
329
327
|
rdoc_options: []
|
|
330
328
|
require_paths:
|
|
331
329
|
- lib
|
|
@@ -340,8 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
340
338
|
- !ruby/object:Gem::Version
|
|
341
339
|
version: '0'
|
|
342
340
|
requirements: []
|
|
343
|
-
rubygems_version: 3.
|
|
344
|
-
signing_key:
|
|
341
|
+
rubygems_version: 3.6.9
|
|
345
342
|
specification_version: 4
|
|
346
343
|
summary: AsciiDoc parser for metanorma
|
|
347
344
|
test_files: []
|