mumukit-directives 0.3.0 → 0.3.1
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d404944c578e7a56d745cbdf8adf110599ef29c07954aff201f36469694c092
|
4
|
+
data.tar.gz: dc3ce9797fbd0923b3726760d1800afa119260e28d96051dd1af67b288d022cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ab936fc6db1450368d3f1230a71d96ba400bd085287f6b0f3efc00ee723b5e75bdc7681a030a1eb2e81dd8a4e2d5a8a95f7d352826c569699a8f3fe30c5cc30
|
7
|
+
data.tar.gz: d044ed922a7ffe9dc8c3198d30b3aed7c277e535ad39cec94509721e844cdc617953d2c2d717f199778985f4d1f146e004c357494c291f0884a89f6a964a513b
|
@@ -2,21 +2,38 @@ module Mumukit::Directives::CommentType
|
|
2
2
|
def self.parse(string)
|
3
3
|
case string
|
4
4
|
when 'ruby' then
|
5
|
-
|
5
|
+
Ruby
|
6
6
|
when 'haskell' then
|
7
|
-
|
7
|
+
Haskell
|
8
8
|
else
|
9
|
-
|
9
|
+
Cpp
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
module Comment
|
14
|
+
def comment(code)
|
15
|
+
"#{open}#{code}#{close}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def open_comment
|
19
|
+
Regexp.new Regexp.escape(open)
|
20
|
+
end
|
21
|
+
|
22
|
+
def close_comment
|
23
|
+
Regexp.new Regexp.escape(close)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
13
28
|
module Cpp
|
14
|
-
|
15
|
-
|
29
|
+
extend Comment
|
30
|
+
|
31
|
+
def self.open
|
32
|
+
'/*'
|
16
33
|
end
|
17
34
|
|
18
|
-
def self.
|
19
|
-
|
35
|
+
def self.close
|
36
|
+
'*/'
|
20
37
|
end
|
21
38
|
|
22
39
|
def self.to_s
|
@@ -25,12 +42,14 @@ module Mumukit::Directives::CommentType
|
|
25
42
|
end
|
26
43
|
|
27
44
|
module Ruby
|
28
|
-
|
29
|
-
|
45
|
+
extend Comment
|
46
|
+
|
47
|
+
def self.open
|
48
|
+
'#'
|
30
49
|
end
|
31
50
|
|
32
|
-
def self.
|
33
|
-
|
51
|
+
def self.close
|
52
|
+
'#'
|
34
53
|
end
|
35
54
|
|
36
55
|
def self.to_s
|
@@ -39,12 +58,14 @@ module Mumukit::Directives::CommentType
|
|
39
58
|
end
|
40
59
|
|
41
60
|
module Haskell
|
42
|
-
|
43
|
-
|
61
|
+
extend Comment
|
62
|
+
|
63
|
+
def self.open
|
64
|
+
'{-'
|
44
65
|
end
|
45
66
|
|
46
|
-
def self.
|
47
|
-
|
67
|
+
def self.close
|
68
|
+
'-}'
|
48
69
|
end
|
49
70
|
|
50
71
|
def self.to_s
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Mumukit::Directives::Interpolations < Mumukit::Directives::Directive
|
2
|
-
def initialize(key)
|
2
|
+
def initialize(key=nil)
|
3
3
|
@key = key
|
4
4
|
end
|
5
5
|
|
@@ -15,14 +15,20 @@ class Mumukit::Directives::Interpolations < Mumukit::Directives::Directive
|
|
15
15
|
interpolated = []
|
16
16
|
|
17
17
|
var = code.captures(comment_regexp) do
|
18
|
-
|
19
|
-
|
18
|
+
substitution = sections[$1]
|
19
|
+
if substitution
|
20
|
+
interpolated << $1
|
21
|
+
substitution
|
22
|
+
else
|
23
|
+
$&
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
[var, interpolated.uniq]
|
23
28
|
end
|
24
29
|
|
25
30
|
def transform(sections)
|
31
|
+
raise 'Missing key. Build the interpolations with a key in order to use this method' unless @key
|
26
32
|
code = sections[@key]
|
27
33
|
if interpolations? code
|
28
34
|
interpolation, interpolated = interpolate code, sections.except(@key)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Mumukit::Directives::Sections < Mumukit::Directives::Directive
|
2
2
|
def regexp
|
3
|
-
/<(.+?)##{comment_type.close_comment}(.+?)#{comment_type.open_comment}#(.+?)>/
|
3
|
+
/<(.+?)##{comment_type.close_comment}(.+?)#{comment_type.open_comment}#(.+?)>/m
|
4
4
|
end
|
5
5
|
|
6
6
|
def split_sections(code)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-directives
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.7.3
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Interpolations, sections and flags pipelines for mumuki
|