html2doc 1.10.0 → 1.10.1
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/README.adoc +1 -1
- data/lib/html2doc/mime.rb +21 -7
- data/lib/html2doc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec617237a616948fc0d46e624845dcc144a773e04cde204fee8e795dd0bb1c60
|
|
4
|
+
data.tar.gz: 763ab17d11cd59c7f0cad2878a84fb30cd312877896912cf30025a1ccc4db060
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29105bd6bf8f151cafbff331f9eb8c9b225a0a203424bd02525ad700abb39f27fccd502dfb9306f6cf670751c8af27a28657dc32b3b8edde0c70543379ed2fd2
|
|
7
|
+
data.tar.gz: a57f0972562c7f2f766b7a91c5a7a522e18b8f876981301c34e8491812e2413ad6827b79a9e604a1c1cf985741c5e31754896ef77192dedb29f77396352bec66
|
data/README.adoc
CHANGED
|
@@ -4,7 +4,7 @@ https://github.com/metanorma/html2doc/workflows/main/badge.svg
|
|
|
4
4
|
|
|
5
5
|
image:https://img.shields.io/gem/v/html2doc.svg["Gem Version", link="https://rubygems.org/gems/html2doc"]
|
|
6
6
|
image:https://github.com/metanorma/html2doc/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/html2doc/actions?workflow=rake"]
|
|
7
|
-
image:https://codeclimate.com/github/metanorma/html2doc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/html2doc"]
|
|
7
|
+
// image:https://codeclimate.com/github/metanorma/html2doc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/html2doc"]
|
|
8
8
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/html2doc.svg["Pull Requests", link="https://github.com/metanorma/html2doc/pulls"]
|
|
9
9
|
image:https://img.shields.io/github/commits-since/metanorma/html2doc/latest.svg["Commits since latest",link="https://github.com/metanorma/html2doc/releases"]
|
|
10
10
|
|
data/lib/html2doc/mime.rb
CHANGED
|
@@ -90,22 +90,36 @@ class Html2Doc
|
|
|
90
90
|
%r{^([A-Z]:)?/}.match?(src) ? src : File.join(localdir, src)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
IMAGE_IMAGEDATA =
|
|
94
|
+
".//*[local-name() = 'img' or local-name() = 'imagedata']".freeze
|
|
95
|
+
|
|
93
96
|
# only processes locally stored images
|
|
94
97
|
def image_cleanup(docxml, dir, localdir)
|
|
95
98
|
maxheight, maxwidth = page_dimensions(docxml)
|
|
96
|
-
docxml.
|
|
99
|
+
docxml.xpath(IMAGE_IMAGEDATA).each do |i|
|
|
97
100
|
skip_image_cleanup?(i) and next
|
|
98
101
|
local_filename = rename_image(i, dir, localdir)
|
|
99
|
-
i
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
if tr_ancestor = i.xpath("ancestor::*[local-name() = 'tr']").first
|
|
103
|
+
image_count = tr_ancestor.xpath(IMAGE_IMAGEDATA).count
|
|
104
|
+
image_resize(i, local_filename, maxheight, maxwidth, image_count)
|
|
105
|
+
else # Normal behavior for non-table images
|
|
106
|
+
image_resize(i, local_filename, maxheight, maxwidth, 1)
|
|
107
|
+
end
|
|
105
108
|
end
|
|
106
109
|
docxml
|
|
107
110
|
end
|
|
108
111
|
|
|
112
|
+
def image_resize(img, local_filename, maxheight, maxwidth, image_count)
|
|
113
|
+
img["width"], img["height"] =
|
|
114
|
+
if landscape?(img)
|
|
115
|
+
Vectory.image_resize(img, local_filename, maxwidth,
|
|
116
|
+
maxheight / image_count)
|
|
117
|
+
else
|
|
118
|
+
Vectory.image_resize(img, local_filename, maxheight,
|
|
119
|
+
maxwidth / image_count)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
109
123
|
def landscape?(img)
|
|
110
124
|
img.ancestors.each do |a|
|
|
111
125
|
a.name == "div" or next
|
data/lib/html2doc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: html2doc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.10.
|
|
4
|
+
version: 1.10.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|