aml 0.1.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/aml +1 -1
- data/lib/aml.rb +8 -145
- data/lib/aml/Argument.rb +100 -0
- data/lib/aml/Build.rb +203 -0
- data/lib/aml/Cluster.rb +201 -0
- data/lib/aml/Compile.rb +217 -0
- data/lib/aml/Definition.rb +71 -0
- data/lib/aml/Line.rb +80 -0
- data/lib/aml/Parse.rb +24 -0
- data/lib/aml/Prepare.rb +59 -0
- data/lib/aml/core/method.rb +17 -2
- data/lib/aml/core/mixin.aml +1 -1
- metadata +10 -14
- data/bin/aml-bundle +0 -3
- data/lib/aml-bundle.rb +0 -52
- data/lib/aml/argument.rb +0 -80
- data/lib/aml/compile.rb +0 -325
- data/lib/aml/definition.rb +0 -71
- data/lib/aml/error.rb +0 -97
- data/lib/aml/line_type.rb +0 -57
- data/lib/aml/make.rb +0 -12
- data/lib/aml/parse.rb +0 -81
- data/lib/aml/requirement.rb +0 -9
- data/lib/aml/watch.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4554e8086f2ded34322b99b7d29197f0d106d547
|
4
|
+
data.tar.gz: 6a46a20ef78e5888ffd391c960744d5f3382acce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 984d81c03eecfc52d2bc73376837809fa7ddeb0abbc5dd0dd978df88160693b0cd367332b0ca3d096c367849fd75dcf1d3a69ef03defdf96e1426cb240ec3320
|
7
|
+
data.tar.gz: 30632d24ea907aa6884944f770c5c32b8a1308c9ea8d1ef1967a590a8b4fe3f3c41d938f8d6ad3e6474b2787340c94fdd92ba9b39da73d559283bf07108f3ce3
|
data/bin/aml
CHANGED
data/lib/aml.rb
CHANGED
@@ -1,148 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
argument = Argument.new(arguments,error)
|
10
|
-
argument.required('watch','The required --watch argument has not been defined.')
|
11
|
-
if(argument.has_requirements? == false)
|
12
|
-
argument.clear_required
|
13
|
-
argument.required('build','The required --build argument has not been defined.')
|
14
|
-
if(argument.has_requirements?)
|
15
|
-
argument.clear_required
|
16
|
-
argument.create('watch',argument.read('build'))
|
17
|
-
argument.create('build','true')
|
18
|
-
end
|
19
|
-
else
|
20
|
-
argument.create('build','false')
|
21
|
-
end
|
22
|
-
if argument.has_requirements? and File.exist?(argument.read('watch'))
|
23
|
-
basePath = File.dirname(argument.read('watch'))
|
24
|
-
@basePath = basePath
|
25
|
-
watchFile = File.basename(argument.read('watch'))
|
26
|
-
@watchFile = watchFile
|
27
|
-
#Arguments from aml-config
|
28
|
-
configFile = File.join(basePath,'aml-config')
|
29
|
-
argument.parse(File.read(configFile)) if File.exist?(configFile)
|
30
|
-
#Arguments
|
31
|
-
argument.create('watch',watchFile)
|
32
|
-
argument.create_if_empty('basePath',basePath)
|
33
|
-
argument.create_if_empty('fileExtension','html')
|
34
|
-
argument.create_if_empty('fileOutput',"#{File.basename(argument.read('watch'), ".*")}.#{argument.read('fileExtension')}")
|
35
|
-
argument.create_if_empty('selfClosing',"area,base,basefont,bgsound,br,col,frame,hr,img,isindex,input,keygen,link,meta,param,source,track,wbr")
|
36
|
-
|
37
|
-
argument.create_if_empty('aml-watch-instance', "#{instance}")
|
38
|
-
|
39
|
-
parse = Parse.new(argument.read('basePath'), argument.read('watch'))
|
40
|
-
files = []
|
41
|
-
|
42
|
-
#Watch Partials
|
43
|
-
parse.watch.each do |this|
|
44
|
-
file = File.join(basePath, this[:bundle] ? File.join(this[:bundle],'partial') : this[:partial] ? 'partial' : '' , this[:file])
|
45
|
-
files << file
|
46
|
-
end
|
47
|
-
|
48
|
-
#Watch Mixins
|
49
|
-
parse.mixin.each do |this|
|
50
|
-
file = File.join(basePath, this[:bundle] ? File.join(this[:bundle]) : this[:partial] ? 'partial' : '' , this[:file]) if this[:bundle] != false
|
51
|
-
files << file if file != nil
|
52
|
-
end
|
53
|
-
|
54
|
-
#Define Core Bundle's Methods, Mixins, & Variables...
|
55
|
-
core_definition = false
|
56
|
-
if(File.exists?(File.join(File.dirname(File.expand_path(__FILE__)),'aml','core','mixin.aml')))
|
57
|
-
bundle = Parse.new(File.join(File.dirname(File.expand_path(__FILE__)), 'aml','core'),'mixin.aml')
|
58
|
-
definition = Definition.new(bundle.file,"core",false,true,true)
|
59
|
-
core_definition = true
|
60
|
-
else
|
61
|
-
error.log('core',false,'mixin.aml',false,'file does not exist')
|
62
|
-
end
|
63
|
-
|
64
|
-
if(File.exists?(File.join(File.dirname(File.expand_path(__FILE__)),'aml','core','method.rb')))
|
65
|
-
begin
|
66
|
-
class_eval File.read(File.join(File.dirname(File.expand_path(__FILE__)),'aml','core','method.rb'))
|
67
|
-
rescue Exception => e
|
68
|
-
x = e.message.match(error.match)
|
69
|
-
error.log('core',false,"method.rb",x[:line],x[:message])
|
70
|
-
end
|
71
|
-
else
|
72
|
-
error.log('core',false,'method.rb',false,'file does not exist')
|
73
|
-
end
|
74
|
-
|
75
|
-
#Define --watch Methods, Mixins, & Variables...
|
76
|
-
if core_definition
|
77
|
-
definition.add(parse.file,false,true,true,true)
|
78
|
-
else
|
79
|
-
definition = Definition.new(parse.file,false,true,true,true)
|
80
|
-
end
|
81
|
-
|
82
|
-
#Define Additional Bundle Methods & Mixins
|
83
|
-
definition.bundles.each do |directory,name|
|
84
|
-
if directory != 'core' then
|
85
|
-
if File.exists?(File.join(basePath,directory,'method.rb'))
|
86
|
-
begin
|
87
|
-
class_eval File.read(File.join(basePath,directory,'method.rb'))
|
88
|
-
rescue Exception => e
|
89
|
-
x = e.message.match(error.match)
|
90
|
-
error.log(directory,false,"method.rb",x[:line],x[:message])
|
91
|
-
end
|
92
|
-
else
|
93
|
-
error.log(directory,false,'method.rb',false,'file does not exist')
|
94
|
-
end
|
95
|
-
if File.exists?(File.join(basePath,directory,'mixin.aml'))
|
96
|
-
bundle = Parse.new(File.join(basePath,directory),'mixin.aml')
|
97
|
-
definition.add(bundle.file,directory,false,true,true)
|
98
|
-
else
|
99
|
-
error.log(directory,false,'mixin.aml',false,'file does not exist')
|
100
|
-
end
|
101
|
-
#Watch Additional Bundle Partials
|
102
|
-
Dir[File.join(basePath,directory,'partial','*.aml')].each do |partial|
|
103
|
-
files << partial
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
#Watch or Build
|
109
|
-
@makeFile = argument.read('fileOutput')
|
110
|
-
compile = Compile.new(parse,argument,definition,error)
|
111
|
-
error.log_delete if error.count == 0
|
112
|
-
error.log_create if error.count > 0
|
113
|
-
if argument.read('build') == 'false'
|
114
|
-
if(error.count == 0)
|
115
|
-
print "\r\b\e[0KWatching #{files.count} file#{files.count != 1 ? "s" : ""}"" for updates... "
|
116
|
-
else
|
117
|
-
print "\r\b\e[0KPlease resolve all issues found in aml-error... "
|
118
|
-
end
|
119
|
-
watch = Watch.new(files, arguments, argument.read('aml-watch-instance').to_i+1, argument.read('build'))
|
120
|
-
else
|
121
|
-
if(error.count == 0)
|
122
|
-
puts "Build complete."
|
123
|
-
else
|
124
|
-
puts "Please resolve all issues found in aml-error."
|
125
|
-
end
|
126
|
-
end
|
127
|
-
else
|
128
|
-
if argument.defined('version')
|
129
|
-
puts Gem.loaded_specs['aml'].version.to_s
|
130
|
-
else
|
131
|
-
puts argument.read('watch').to_s.length == 0 ? "Please define the --watch or --build argument." : "File not found."
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
def self.makeFile
|
137
|
-
@makeFile
|
138
|
-
end
|
139
|
-
|
140
|
-
def self.basePath
|
141
|
-
@basePath
|
142
|
-
end
|
143
|
-
|
144
|
-
def self.watchFile
|
145
|
-
@watchFile
|
1
|
+
# Entry Point for Abstract Markup Language
|
2
|
+
class AbstractMarkupLanguage
|
3
|
+
require "aml/Build"
|
4
|
+
def initialize(argument)
|
5
|
+
if ['--v', '--version', 'version'].include? argument.downcase
|
6
|
+
puts Gem.loaded_specs['aml'].version.to_s
|
7
|
+
else
|
8
|
+
@build = Build.new(argument)
|
146
9
|
end
|
147
10
|
end
|
148
11
|
end
|
data/lib/aml/Argument.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
class Argument
|
2
|
+
def initialize(argument={})
|
3
|
+
@item = {}
|
4
|
+
@item_key = {}
|
5
|
+
argument.each do |argument|
|
6
|
+
initialize_add(argument)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
def parse(argument)
|
10
|
+
arguments = argument.split('--')
|
11
|
+
if arguments.count == 1
|
12
|
+
arguments = []
|
13
|
+
io = argument.split(' ')
|
14
|
+
arguments << "build " + io[0] #input file
|
15
|
+
if io.count == 2
|
16
|
+
arguments << "path " + File.dirname(io[1]) #output path
|
17
|
+
arguments << "name " + File.basename(io[1],'.*') #output name
|
18
|
+
arguments << "extension " + File.extname(io[1])[1..-1] if io[1].split('.').count > 1 #output extension
|
19
|
+
end
|
20
|
+
end
|
21
|
+
arguments.each do |argument|
|
22
|
+
string = argument.split(' ')
|
23
|
+
set(string[0], string[1..string.count].join(' ').to_s) if argument.strip.length > 0
|
24
|
+
end
|
25
|
+
end
|
26
|
+
def define(name,value,usage,required=false)
|
27
|
+
regex = /\[(?<key>\w)\]/
|
28
|
+
keys = []
|
29
|
+
name = name.gsub(regex).each do |match|
|
30
|
+
match = match.match(regex)[:key]
|
31
|
+
keys << match
|
32
|
+
match
|
33
|
+
end
|
34
|
+
@item[name.to_sym] = {
|
35
|
+
:value => value,
|
36
|
+
:usage => usage,
|
37
|
+
:require => required
|
38
|
+
}
|
39
|
+
@item_key[keys.join.to_sym] = name.to_sym if keys.count > 0
|
40
|
+
end
|
41
|
+
def set(name, value=nil)
|
42
|
+
begin
|
43
|
+
@item[_name(name)][:value] = value.to_s
|
44
|
+
rescue
|
45
|
+
end
|
46
|
+
end
|
47
|
+
def get(name)
|
48
|
+
begin
|
49
|
+
@item[_name(name)][:value].to_s
|
50
|
+
rescue
|
51
|
+
end
|
52
|
+
end
|
53
|
+
def items
|
54
|
+
@item
|
55
|
+
end
|
56
|
+
def show_help?
|
57
|
+
@item.select{|k,v| k == :help and v[:value] != false}.count == 0 ? false : true
|
58
|
+
end
|
59
|
+
def show_help
|
60
|
+
pad = _pad(@item)
|
61
|
+
@item.each do |name,data|
|
62
|
+
value = data[:value].to_s
|
63
|
+
value = nil.to_s if name == :help
|
64
|
+
puts "--#{name.to_s.ljust(pad[:name]+1)}\t#{value.ljust(pad[:value]+1)}\t#{data[:usage].ljust(pad[:usage])}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
def has_requirements?
|
68
|
+
@item.select{|k,v| v[:require] == true and v[:value] == nil}.count == 0 ? true : false
|
69
|
+
end
|
70
|
+
def show_required
|
71
|
+
required = @item.select{|k,v| v[:require] == true and v[:value] == nil}
|
72
|
+
if required.count == 1
|
73
|
+
puts "Please define the --#{required.first.first} argument; #{required.first.last[:usage]}"
|
74
|
+
else
|
75
|
+
pad = _pad(required)
|
76
|
+
required.each do |name,data|
|
77
|
+
value = data[:value].to_s
|
78
|
+
value = nil.to_s if name == :help
|
79
|
+
puts "--#{name.to_s.ljust(pad[:name]+1)}\t#{value.ljust(pad[:value]+1)}\t#{data[:usage].ljust(pad[:usage])}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
private
|
84
|
+
def _name(name)
|
85
|
+
if @item.select{|k|k == name.to_sym}.count == 0
|
86
|
+
name = @item_key[name.to_sym]
|
87
|
+
else
|
88
|
+
name = name.to_sym
|
89
|
+
end
|
90
|
+
end
|
91
|
+
def _pad(items)
|
92
|
+
pad = {:name=>0,:value=>0,:usage=>0}
|
93
|
+
items.each do |name,data|
|
94
|
+
pad[:name] = name.to_s.length if name.to_s.length > pad[:name]
|
95
|
+
pad[:value] = data[:value].to_s.length if data[:value].to_s.length > pad[:value]
|
96
|
+
pad[:usage] = data[:usage].to_s.length if data[:usage].to_s.length > pad[:usage]
|
97
|
+
end
|
98
|
+
pad
|
99
|
+
end
|
100
|
+
end
|
data/lib/aml/Build.rb
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
class Build
|
2
|
+
require "aml/Argument"
|
3
|
+
require "aml/Compile"
|
4
|
+
|
5
|
+
@@structure = []
|
6
|
+
@@selfClosing = []
|
7
|
+
|
8
|
+
def initialize(attribute=nil)
|
9
|
+
@argument = Argument.new()
|
10
|
+
@argument.define('[b]uild', nil, 'input file path and name', true)
|
11
|
+
#@argument.define('[w]atch', false, 'watch for build updates')
|
12
|
+
@argument.define('[s]elf[c]losing', true, 'enable self closing tags')
|
13
|
+
@argument.define('[p]ath', nil, 'output file path')
|
14
|
+
@argument.define('[n]ame', nil, 'output file name')
|
15
|
+
@argument.define('[e]xtension', 'html', 'output file extension')
|
16
|
+
@argument.define('[o]utput', nil, 'output file path and name')
|
17
|
+
@argument.define('[h]elp', false, 'list all arguments')
|
18
|
+
@argument.parse(attribute)
|
19
|
+
if @argument.get('build') != nil.to_s
|
20
|
+
@argument.set('path', File.dirname(@argument.get('build'))) if @argument.get('path') == nil.to_s
|
21
|
+
@argument.set('name', File.basename(@argument.get('build'),'.*')) if @argument.get('name') == nil.to_s
|
22
|
+
if @argument.get('output') == nil.to_s
|
23
|
+
@argument.set('output', File.join(@argument.get('path'), @argument.get('name') + '.' + @argument.get('extension')))
|
24
|
+
else
|
25
|
+
@argument.set('path', File.dirname(@argument.get('output')))
|
26
|
+
@argument.set('name', File.basename(@argument.get('output'),'.*'))
|
27
|
+
@argument.set('extension', File.extname(@argument.get('output'))[1..-1])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
if @argument.get('selfclosing').to_s.downcase == 'true'
|
32
|
+
@@selfClosing = %w[area base basefont bgsound br col frame hr img isindex input keygen link meta param source track wbr]
|
33
|
+
elsif @argument.get('selfclosing').to_s.downcase != 'false'
|
34
|
+
@@selfClosing = @argument.get('selfclosing').to_s.downcase.split(',')
|
35
|
+
@argument.set('selfclosing','custom')
|
36
|
+
end
|
37
|
+
|
38
|
+
if @argument.show_help?
|
39
|
+
@argument.show_help
|
40
|
+
elsif @argument.has_requirements?
|
41
|
+
@compile = Compile.new(@argument)
|
42
|
+
@compile.process
|
43
|
+
@compile.post_process
|
44
|
+
if @compile.log.select{|k|k[:fail]==true}.count == 0
|
45
|
+
console
|
46
|
+
process_complete
|
47
|
+
else
|
48
|
+
console
|
49
|
+
end
|
50
|
+
else
|
51
|
+
@argument.show_required
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def console
|
56
|
+
@compile.log.each do |log|
|
57
|
+
line = log[:line] ? ":#{log[:line]}" : ""
|
58
|
+
puts "#{log[:file]}#{line} - #{log[:message]}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def process_complete
|
63
|
+
structure = prepare_structure(prepare_string_line_merge(@compile.structure))
|
64
|
+
recursive_merge_lines(structure)
|
65
|
+
structure.each do |group|
|
66
|
+
recursive_close(group,0,0)
|
67
|
+
end
|
68
|
+
File.open(@argument.get('output'), 'w'){|file|
|
69
|
+
struct_count = @@structure.count-1
|
70
|
+
@@structure.each_with_index do |line,index|
|
71
|
+
new_line = (index < struct_count) ? $/ : ""
|
72
|
+
file.write(line+new_line) if line.strip.length > 0
|
73
|
+
end
|
74
|
+
}
|
75
|
+
puts "Build completed."
|
76
|
+
end
|
77
|
+
private
|
78
|
+
|
79
|
+
def recursive_close(struct,index=0,index_reset)
|
80
|
+
next_index = struct.key?(:line) ? index+1 : index
|
81
|
+
tab_index = "\t" * (index-index_reset)
|
82
|
+
opening_tag_attributes = ""
|
83
|
+
opening_tag = ""
|
84
|
+
closing_tag = ""
|
85
|
+
|
86
|
+
#STRING
|
87
|
+
if(struct[:line][:type]==:string)
|
88
|
+
opening_tag = struct[:line][:value]
|
89
|
+
end
|
90
|
+
|
91
|
+
#TAG
|
92
|
+
if(struct[:line][:type]==:tag)
|
93
|
+
|
94
|
+
struct[:line][:close] = :self if @@selfClosing.include? struct[:line][:name]
|
95
|
+
|
96
|
+
opening_tag_attributes = tag_line_attributes(struct[:line],"")
|
97
|
+
opening_tag = "<#{struct[:line][:name]}#{opening_tag_attributes}>"
|
98
|
+
closing_tag = "</#{struct[:line][:name]}>"
|
99
|
+
if struct.key?(:line)
|
100
|
+
if struct[:line][:close] == :self
|
101
|
+
opening_tag = "<#{struct[:line][:name]}#{opening_tag_attributes} />"
|
102
|
+
closing_tag = ""
|
103
|
+
end
|
104
|
+
if struct[:line][:close] == :none
|
105
|
+
closing_tag = ""
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
tag_text = struct[:line][:text]
|
110
|
+
if struct.key?(:children)
|
111
|
+
new_line = "\r\n"
|
112
|
+
#Tab Reset
|
113
|
+
index_reset = struct[:line][:index]+1 if struct[:line][:reset]
|
114
|
+
|
115
|
+
tag_text = "#{new_line}#{tab_index}\t#{tag_text}" if tag_text.to_s.length > 0
|
116
|
+
|
117
|
+
@@structure << "#{tab_index}#{opening_tag}#{tag_text}" if struct.key?(:line)
|
118
|
+
struct[:children].each do |struct_children|
|
119
|
+
recursive_close(struct_children,next_index,index_reset)
|
120
|
+
end
|
121
|
+
|
122
|
+
@@structure << "#{tab_index}#{closing_tag}" if struct.key?(:line)
|
123
|
+
else
|
124
|
+
@@structure << "#{tab_index}#{opening_tag}#{tag_text}#{closing_tag}"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def tag_line_attributes(line,base="")
|
129
|
+
if line[:type] == :tag
|
130
|
+
attributes = hash_to_attribute_build(line[:attribute],"",line)
|
131
|
+
attributes = " #{attributes}" if(attributes.length > 0)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def hash_to_attribute_build(hash,base="",line)
|
136
|
+
hash = hash.sort_by{|key, value| key}
|
137
|
+
string = ""
|
138
|
+
hash.each do |key, value|
|
139
|
+
if(value.is_a?(Hash))
|
140
|
+
value.sort_by{|key, value| key}
|
141
|
+
string << "#{hash_to_attribute_build(value,"#{base}#{key}-",line)} "
|
142
|
+
else
|
143
|
+
string << "#{base}#{key}=\"#{value}\" " if value.to_s.length > 0
|
144
|
+
end
|
145
|
+
end
|
146
|
+
string.strip
|
147
|
+
end
|
148
|
+
|
149
|
+
def prepare_structure(struct,index=0,pstruct={:line=>false,:children=>[]})
|
150
|
+
parent_tags = struct.each_index.select{|i| struct[i][:index] == index}.compact
|
151
|
+
parent_struct = []
|
152
|
+
parent_tags.each_with_index do |struct_index,index|
|
153
|
+
last_struct_index = parent_tags.count > index+1 ? parent_tags[index+1]-1 : parent_tags[index]
|
154
|
+
last_struct_index = struct.count if(parent_tags.count == index+1)
|
155
|
+
parent_struct << struct[struct_index..last_struct_index]
|
156
|
+
end
|
157
|
+
parent_struct.each do |parent_structure|
|
158
|
+
index_struct = {}
|
159
|
+
index_struct[:line] = parent_structure[0]
|
160
|
+
c = prepare_structure(parent_structure,index+1)
|
161
|
+
index_struct[:children] = c if c.count > 0
|
162
|
+
pstruct[:children] << index_struct
|
163
|
+
end
|
164
|
+
pstruct[:children]
|
165
|
+
end
|
166
|
+
|
167
|
+
def recursive_merge_lines(struct,count=0)
|
168
|
+
struct.each_with_index do |group,struct_index|
|
169
|
+
group.each_with_index do |line,gindex|
|
170
|
+
if line.first == :line
|
171
|
+
if line.last[:type] == :string and line.last[:merge]
|
172
|
+
next_line = struct[struct_index+1].first
|
173
|
+
if next_line.first == :line and next_line.last[:type] == :string
|
174
|
+
line.last[:value] += next_line.last[:value]
|
175
|
+
line.last[:merge] = next_line.last[:merge]
|
176
|
+
line.last[:merge] = struct_index+1 == struct.count ? false : line.last[:merge]
|
177
|
+
struct.delete_at struct_index+1
|
178
|
+
else
|
179
|
+
line.last[:merge] = false
|
180
|
+
end
|
181
|
+
count +=1 if line.last[:merge]
|
182
|
+
end
|
183
|
+
else
|
184
|
+
recursive_merge_lines(line.last)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
recursive_merge_lines(struct) if count > 0
|
189
|
+
end
|
190
|
+
|
191
|
+
def prepare_string_line_merge(lines)
|
192
|
+
regex = /\+\+$/
|
193
|
+
lines.each_with_index do |line,index|
|
194
|
+
if(line[:type] == :string)
|
195
|
+
line[:merge] = line[:value].to_s.match(regex) != nil
|
196
|
+
line[:value] = line[:value].to_s.gsub(regex,'') if line[:merge]
|
197
|
+
end
|
198
|
+
end
|
199
|
+
lines
|
200
|
+
end
|
201
|
+
|
202
|
+
|
203
|
+
end
|