hamlit-block 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1abd0ce08b2e4ff7e417ff0d4b3b2b1fabfcf073
|
4
|
+
data.tar.gz: 1088a092796c1cb6b49531f15dce6555ec177006
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27f0f46ae8b05d9178975192cc837ab6f48244434e5bdd95979449dbb0d0aa52cd2334267ce006d1b9932e39f17464f5ad79eb7b8fe7d5a164643fd40280f7a7
|
7
|
+
data.tar.gz: 67a602550adaa07b2626597781845067f908b736ce3fcdf3554c5585a2c8e4ec72aa269987097ee182b309f19282bf5bc0c4c6dec7226e8881ab8528b4621d91
|
data/lib/hamlit/block.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
require "hamlit"
|
2
|
+
require "hamlit/block/compiler_extension"
|
2
3
|
require "hamlit/block/script_compiler_extension"
|
4
|
+
require "hamlit/block/silent_script_compiler_extension"
|
3
5
|
require "hamlit/block/version"
|
4
6
|
|
5
7
|
module Hamlit
|
6
8
|
class Compiler
|
9
|
+
prepend Block::CompilerExtension
|
10
|
+
|
7
11
|
ScriptCompiler.send(:prepend, Block::ScriptCompilerExtension)
|
12
|
+
SilentScriptCompiler.send(:prepend, Block::SilentScriptCompilerExtension)
|
8
13
|
end
|
9
14
|
|
10
15
|
# Maybe hamlit-block's users expect this. This is Haml's default.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Hamlit
|
2
|
+
module Block
|
3
|
+
# Suppress block's internal rendering result and pass it to [:capture, ...].
|
4
|
+
# if it script is `do .. end` block
|
5
|
+
module SilentScriptCompilerExtension
|
6
|
+
attr_writer :identity
|
7
|
+
|
8
|
+
BLOCK_REGEX = /do(\s*\|\s*[^\|]*\s*\|)?\s*\z/
|
9
|
+
|
10
|
+
def compile_with_children(node, &block)
|
11
|
+
if node.value[:text] =~ BLOCK_REGEX
|
12
|
+
[:multi,
|
13
|
+
[:block, node.value[:text],
|
14
|
+
[:multi,
|
15
|
+
[:newline],
|
16
|
+
[:capture, @identity.generate, yield(node)],
|
17
|
+
],
|
18
|
+
]
|
19
|
+
]
|
20
|
+
else
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/hamlit/block/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamlit-block
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hamlit
|
@@ -118,7 +118,9 @@ files:
|
|
118
118
|
- bin/setup
|
119
119
|
- hamlit-block.gemspec
|
120
120
|
- lib/hamlit/block.rb
|
121
|
+
- lib/hamlit/block/compiler_extension.rb
|
121
122
|
- lib/hamlit/block/script_compiler_extension.rb
|
123
|
+
- lib/hamlit/block/silent_script_compiler_extension.rb
|
122
124
|
- lib/hamlit/block/version.rb
|
123
125
|
homepage: https://github.com/hamlit/hamlit-block
|
124
126
|
licenses:
|
@@ -140,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
142
|
version: '0'
|
141
143
|
requirements: []
|
142
144
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.5.1
|
144
146
|
signing_key:
|
145
147
|
specification_version: 4
|
146
148
|
summary: Hamlit extension to support capturing via yield
|