content_for_once 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/content_for_once/helpers.rb +5 -2
- data/lib/content_for_once/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39029b89781a30278e60acc026418ce56947f1a8
|
4
|
+
data.tar.gz: b54d71e3215b3807f664c946bfdba633b77b1a7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8521ac5487cb55ecffbc701140117e7486203228a56b6152ae49d18a5f2ff4bb7c0575cc3b69cb4148c59ace0510f4892cd6589bd3fe923b11ae45443fd0d0f
|
7
|
+
data.tar.gz: a1c0995b8819dac8b06056321104d95f40d7f39b49e8db68e812647bd7fdd3db4334f522f872e9277ef1b9b3dfe2b3a966d6d24df74359b98756fde79885b219
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# ContentForOnce
|
2
|
-
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/content_for_once.svg)](https://badge.fury.io/rb/content_for_once)
|
3
3
|
[![Build Status](https://travis-ci.org/tanukiti1987/content_for_once.svg?branch=master)](https://travis-ci.org/tanukiti1987/content_for_once)
|
4
4
|
|
5
5
|
Seems like `content_for`, content_for_once embed the HTML tags(especially, `javascript_include_tag` and `stylesheet_link_tag`) just only once.
|
@@ -5,11 +5,14 @@ module ContentForOnce
|
|
5
5
|
name = name.to_sym
|
6
6
|
|
7
7
|
@contents[name].concat(capture(&block))
|
8
|
-
@contents[name] = @contents[name].scan(
|
8
|
+
@contents[name] = @contents[name].scan(/<\w+(?:\s+[^>]+)?\/?>*<\/\w+>|<\w+(?:\s+[^>]+)?\/?>/).uniq.join
|
9
9
|
|
10
10
|
@contents.each do |name, content|
|
11
11
|
# ref: https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/capture_helper.rb#L149
|
12
|
-
@view_flow.
|
12
|
+
_content = @view_flow.get(name).presence || ''
|
13
|
+
_content.concat(content.html_safe)
|
14
|
+
_content = _content.scan(/<\w+(?:\s+[^>]+)?\/?>*<\/\w+>|<\w+(?:\s+[^>]+)?\/?>/).uniq.join
|
15
|
+
@view_flow.set(name, _content)
|
13
16
|
end
|
14
17
|
end
|
15
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: content_for_once
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryusuke Sekiguchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.5.1
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Embed the HTML tags just only once
|