webgen 1.5.2 → 1.6.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c19662fd022a762e3796811586f073028780d7631922f6ade3c930d14b7b05e0
|
4
|
+
data.tar.gz: 341981393076fbea3fbc4ea77bebd907c622de58243910638cc46539960786cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 662b03ce9694fff8130e39b1f36e6efbb63c0da37c4c8cde291ee91ae48f2a35791c19e3502a8e7d49354ff2f90636fca9de993b84567e52857c27c949a30c48
|
7
|
+
data.tar.gz: bf93a18ede7b162597b1224de51b757156ec818b506c05620cf4aee403a14ac48b1b529ad5e9538d9a534d2cb1923d72f07241eaca6af56628635d19700ed997
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
@@ -73,6 +73,9 @@ module Webgen
|
|
73
73
|
((context.persistent[:cp_html_head] || {})[:meta] || {}).merge(context.content_node['meta'] || {}).each do |name, content|
|
74
74
|
result += "\n<meta name=\"#{ERB::Util.h(name)}\" content=\"#{ERB::Util.h(content)}\" />"
|
75
75
|
end
|
76
|
+
((context.persistent[:cp_html_head] || {})[:meta_property] || {}).merge(context.content_node['meta_property'] || {}).each do |property, content|
|
77
|
+
result += "\n<meta property=\"#{ERB::Util.h(property)}\" content=\"#{ERB::Util.h(content)}\" />"
|
78
|
+
end
|
76
79
|
result
|
77
80
|
end
|
78
81
|
|
@@ -23,6 +23,13 @@ module Webgen
|
|
23
23
|
(cp_hash[:meta] ||= {})[name] = content
|
24
24
|
end
|
25
25
|
|
26
|
+
# Set the meta tag to the provided value, using +property+ instead of +name+.
|
27
|
+
#
|
28
|
+
# Note that some meta information keys may not be specified multiple times!
|
29
|
+
def meta_property(name, content)
|
30
|
+
(cp_hash[:meta_property] ||= {})[name] = content
|
31
|
+
end
|
32
|
+
|
26
33
|
# Add a link to the given file in the HTML head section.
|
27
34
|
#
|
28
35
|
# The type can either be :css for CSS files or :js for javascript files. The path to the
|
data/lib/webgen/version.rb
CHANGED
@@ -24,13 +24,15 @@ class TestHtmlHead < Minitest::Test
|
|
24
24
|
|
25
25
|
def test_tags_from_context_data
|
26
26
|
@node.meta_info['meta'] = {'other' => 'me'}
|
27
|
+
@node.meta_info['meta_property'] = {'otherprop' => 'me'}
|
27
28
|
context = Webgen::Context.new(@website, :chain => [@node])
|
28
29
|
context.persistent[:cp_html_head] = {
|
29
30
|
:js_file => ['hallo.js', 'hallo2.js', 'hallo.js'],
|
30
31
|
:js_inline => ["somescript", "anotherscript"],
|
31
32
|
:css_file => ['hallo.css', 'hallo2.css', 'hallo.css'],
|
32
33
|
:css_inline => ["somestyle", "anotherstyle"],
|
33
|
-
:meta => {:lucky => 'me<"'}
|
34
|
+
:meta => {:lucky => 'me<"'},
|
35
|
+
:meta_property => {:unlucky => 'me'},
|
34
36
|
}
|
35
37
|
assert_equal("\n<script type=\"text/javascript\" src=\"hallo.js\"></script>" +
|
36
38
|
"\n<script type=\"text/javascript\" src=\"hallo2.js\"></script>" +
|
@@ -41,10 +43,15 @@ class TestHtmlHead < Minitest::Test
|
|
41
43
|
"\n<style type=\"text/css\">/*<![CDATA[/*/\nsomestyle\n/*]]>*/</style>" +
|
42
44
|
"\n<style type=\"text/css\">/*<![CDATA[/*/\nanotherstyle\n/*]]>*/</style>" +
|
43
45
|
"\n<meta name=\"lucky\" content=\"me<"\" />" +
|
44
|
-
"\n<meta name=\"other\" content=\"me\" />"
|
46
|
+
"\n<meta name=\"other\" content=\"me\" />" +
|
47
|
+
"\n<meta property=\"unlucky\" content=\"me\" />" +
|
48
|
+
"\n<meta property=\"otherprop\" content=\"me\" />",
|
49
|
+
@obj.tags_from_context_data(context))
|
45
50
|
|
46
51
|
context.persistent[:cp_html_head] = nil
|
47
|
-
assert_equal("\n<meta name=\"other\" content=\"me\" />"
|
52
|
+
assert_equal("\n<meta name=\"other\" content=\"me\" />" +
|
53
|
+
"\n<meta property=\"otherprop\" content=\"me\" />",
|
54
|
+
@obj.tags_from_context_data(context))
|
48
55
|
|
49
56
|
end
|
50
57
|
|
data/test/webgen/test_context.rb
CHANGED
@@ -74,10 +74,12 @@ class TestContext < Minitest::Test
|
|
74
74
|
@context.html_head.inline_fragment(:css, "content")
|
75
75
|
@context.html_head.inline_fragment(:js, "content")
|
76
76
|
@context.html_head.meta('name', 'content')
|
77
|
+
@context.html_head.meta_property('property', 'content')
|
77
78
|
|
78
79
|
assert_equal(['content'], @context.persistent[:cp_html_head][:css_inline])
|
79
80
|
assert_equal(['content'], @context.persistent[:cp_html_head][:js_inline])
|
80
81
|
assert_equal({'name' => 'content'}, @context.persistent[:cp_html_head][:meta])
|
82
|
+
assert_equal({'property' => 'content'}, @context.persistent[:cp_html_head][:meta_property])
|
81
83
|
end
|
82
84
|
|
83
85
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cmdparse
|