asciidoctor-lazy-images 0.0.2
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 +7 -0
- data/lib/extension.rb +11 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4687b3d0beb8c2c5a8924a1f7fe78e2c1931b16a11d43a7c7c3ac3e4131f36dc
|
4
|
+
data.tar.gz: 8f5e4ec9f454da0efb396e5d08b7860ad6d2f30f3d02a44392c16bebe581d5ab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f2f64dec4c22f39a5f16282e5f0cb8eb00f196a959cb0c504ade30160c06a917f9b6eb95139951c7bbb2b0f1046d13745dd9b7c6c75321a3bd10c05bc2516271
|
7
|
+
data.tar.gz: 56831b695924b8d8d27daa6faa895a515ac3ab0c5d07487bbdbed5cef58b309da534b54298da9d313a254c0f9d390d503d625320c4e5edab85ba40b93931a3fb
|
data/lib/extension.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'asciidoctor/extensions'
|
2
|
+
|
3
|
+
class LazyImagePostprocessor < Asciidoctor::Extensions::Postprocessor
|
4
|
+
def process document, output
|
5
|
+
if document.basebackend? 'html'
|
6
|
+
replacement = %(<img loading=lazy )
|
7
|
+
output = output.gsub(/<img /, replacement)
|
8
|
+
end
|
9
|
+
output
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asciidoctor-lazy-images
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mauville
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Avoid high server loads by making images load lazily
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/extension.rb
|
20
|
+
homepage: https://www.github.com/Mauville/asciidoctor-lazy-images
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubygems_version: 3.2.22
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: Add the loading=lazy attribute to images rendered by the HTML5 backend!
|
43
|
+
test_files: []
|