jekyll-uj-powertools 1.6.12 → 1.6.14
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/jekyll-uj-powertools.gemspec +1 -1
- data/lib/tags/readtime.rb +12 -12
- data/lib/tags/video.rb +7 -3
- 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: 18477ab3973e5e57e8219050d534de95931357c22447f6ee3ad189c78af1303f
|
|
4
|
+
data.tar.gz: ee42cd7804794b12971d8480ca7f4571d7ca1229587d0d6c11e90685eb143a1a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d898ebfb5c473390ddeb41fc125a4cb2e11dfbc8880d48c7b24313538c30311dd62ac917b2bf6d5b87c1c19461cfa10ff205ab308fe72f74490d0aa39295145
|
|
7
|
+
data.tar.gz: 14126d4f4e0fbdb967a3792a3949ed18a4d02160b57c146d24ad58993a9a62dad1f87dfe9f72fbb8046d9d060dab54b4477cd6dc90b349dc806f4e60bffb270c
|
data/lib/tags/readtime.rb
CHANGED
|
@@ -5,7 +5,7 @@ require_relative '../helpers/variable_resolver'
|
|
|
5
5
|
module Jekyll
|
|
6
6
|
class UJReadtimeTag < Liquid::Tag
|
|
7
7
|
include UJPowertools::VariableResolver
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
def initialize(tag_name, markup, tokens)
|
|
10
10
|
super
|
|
11
11
|
@markup = markup.strip
|
|
@@ -15,22 +15,22 @@ module Jekyll
|
|
|
15
15
|
# Get the content to analyze
|
|
16
16
|
content = resolve_content(context)
|
|
17
17
|
return '1' unless content
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
# Strip HTML tags
|
|
20
20
|
stripped_content = strip_html(content)
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
# Count words
|
|
23
23
|
words = count_words(stripped_content)
|
|
24
|
-
|
|
25
|
-
# Calculate readtime (
|
|
26
|
-
readtime = (words /
|
|
24
|
+
|
|
25
|
+
# Calculate readtime (269 words per minute, minimum 1 minute)
|
|
26
|
+
readtime = (words / 269.0).ceil
|
|
27
27
|
readtime = 1 if readtime < 1
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
readtime.to_s
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
private
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
def resolve_content(context)
|
|
35
35
|
if @markup.empty?
|
|
36
36
|
# No argument, use page content
|
|
@@ -42,7 +42,7 @@ module Jekyll
|
|
|
42
42
|
resolve_input(context, @markup)
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
def strip_html(content)
|
|
47
47
|
# Remove HTML tags
|
|
48
48
|
content = content.to_s.gsub(/<script.*?<\/script>/m, '')
|
|
@@ -51,7 +51,7 @@ module Jekyll
|
|
|
51
51
|
content = content.gsub(/\s+/, ' ')
|
|
52
52
|
content.strip
|
|
53
53
|
end
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
def count_words(text)
|
|
56
56
|
# Count words (split by whitespace)
|
|
57
57
|
text.split(/\s+/).length
|
|
@@ -59,4 +59,4 @@ module Jekyll
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
Liquid::Template.register_tag('uj_readtime', Jekyll::UJReadtimeTag)
|
|
62
|
+
Liquid::Template.register_tag('uj_readtime', Jekyll::UJReadtimeTag)
|
data/lib/tags/video.rb
CHANGED
|
@@ -50,7 +50,8 @@ module Jekyll
|
|
|
50
50
|
# parse_arguments and parse_options methods are now provided by VariableResolver module
|
|
51
51
|
|
|
52
52
|
def build_video_element(src, src_path, extension, max_width, options)
|
|
53
|
-
html = "<
|
|
53
|
+
html = "<div class=\"lazy-loading\" data-lazy-load-container>\n"
|
|
54
|
+
html += "<video\n"
|
|
54
55
|
|
|
55
56
|
# Add common video attributes
|
|
56
57
|
css_class = options['class'] || ''
|
|
@@ -83,7 +84,8 @@ module Jekyll
|
|
|
83
84
|
|
|
84
85
|
# Fallback text
|
|
85
86
|
html += "Your browser does not support the video tag.\n"
|
|
86
|
-
html += "</video
|
|
87
|
+
html += "</video>\n"
|
|
88
|
+
html += "</div>"
|
|
87
89
|
|
|
88
90
|
html
|
|
89
91
|
end
|
|
@@ -126,7 +128,8 @@ module Jekyll
|
|
|
126
128
|
poster = options['poster'] || ''
|
|
127
129
|
|
|
128
130
|
# Build video tag on a single line to prevent markdown parsing issues
|
|
129
|
-
html = "<
|
|
131
|
+
html = "<div class=\"lazy-loading\" data-lazy-load-container>"
|
|
132
|
+
html += "<video"
|
|
130
133
|
html += " class=\"#{css_class}\"" unless css_class.empty?
|
|
131
134
|
html += " style=\"#{style}\"" unless style.empty?
|
|
132
135
|
html += " width=\"#{width}\"" unless width.empty?
|
|
@@ -147,6 +150,7 @@ module Jekyll
|
|
|
147
150
|
html += "<source data-lazy=\"@src #{src}\" type=\"video/#{mime_type}\">"
|
|
148
151
|
html += "Your browser does not support the video tag."
|
|
149
152
|
html += "</video>"
|
|
153
|
+
html += "</div>"
|
|
150
154
|
|
|
151
155
|
html
|
|
152
156
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-uj-powertools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ITW Creative Works
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-10-
|
|
11
|
+
date: 2025-10-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|