vanilla 1.12.2 → 1.12.3
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.
- data/Rakefile +1 -1
- data/lib/vanilla/dynasnips/kind.rb +10 -8
- data/test/tmp/soup/current_snip.snip +2 -2
- metadata +3 -3
data/Rakefile
CHANGED
@@ -11,9 +11,9 @@ class Kind < Dynasnip
|
|
11
11
|
end
|
12
12
|
render_entry_collection(snips, entries, as, kind)
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def render_entry_in_template(snip, as, kind)
|
16
|
-
rendered_contents = prepare_snip_contents(snip)
|
16
|
+
rendered_contents = externalise_links(prepare_snip_contents(snip))
|
17
17
|
case as
|
18
18
|
when :html
|
19
19
|
snip_template.
|
@@ -33,13 +33,15 @@ class Kind < Dynasnip
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def prepare_snip_contents(snip)
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
app.render(snip)
|
39
|
+
end
|
40
|
+
|
41
|
+
def externalise_links(content)
|
42
|
+
content.gsub(/href="\//, "href=\"http://#{domain}/").gsub(/src="\//, "src=\"http://#{domain}/")
|
41
43
|
end
|
42
|
-
|
44
|
+
|
43
45
|
def render_entry_collection(snips, entries, as, kind)
|
44
46
|
case as
|
45
47
|
when :html
|
@@ -53,7 +55,7 @@ class Kind < Dynasnip
|
|
53
55
|
end.to_xml
|
54
56
|
end
|
55
57
|
end
|
56
|
-
|
58
|
+
|
57
59
|
attribute :feed_title, "Your Blog"
|
58
60
|
attribute :domain, "yourdomain.com"
|
59
61
|
attribute :snip_template, %{
|
@@ -1,5 +1,7 @@
|
|
1
1
|
CurrentSnip
|
2
2
|
|
3
|
+
:render_as: Ruby
|
4
|
+
:name: current_snip
|
3
5
|
:usage: |-
|
4
6
|
The current_snip dyna normally returns the result of rendering the snip named by the
|
5
7
|
'snip' value in the parameters. This way, it can be used in templates to place the currently
|
@@ -10,5 +12,3 @@ CurrentSnip
|
|
10
12
|
{current_snip name}
|
11
13
|
|
12
14
|
will output the name of the current snip, or the name of the snip currently being edited.
|
13
|
-
:name: current_snip
|
14
|
-
:render_as: Ruby
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 33
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 12
|
9
|
-
-
|
10
|
-
version: 1.12.
|
9
|
+
- 3
|
10
|
+
version: 1.12.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Adam
|