lib/asker/check_input/check_table.rb in asker-tool-2.5.3 vs lib/asker/check_input/check_table.rb in asker-tool-2.5.4
- old
+ new
@@ -9,11 +9,11 @@
@outputs[index][:level] = 2
@outputs[index][:state] = :ok
if find_parent(index) != :concept
@outputs[index][:state] = :err
@outputs[index][:msg] = 'Parent(concept) not found!'
- elsif !line.start_with? ' %table'
+ elsif !line.match(/^\s\s\s\s%table\s*/)
@outputs[index][:state] = :err
@outputs[index][:msg] = 'Write 4 spaces before %table'
end
unless line.include? "%table{"
@@ -23,16 +23,10 @@
unless line.include? "fields:"
@outputs[index][:state] = :err
@outputs[index][:msg] = "fields must be next to : (Without spaces)"
end
-
- # TODO
- #else not /\s+%table{\s?fields:\s?'[A-Za-z,áéíóú]*'\s?}/.match(line)
- # @outputs[index][:state] = :err
- # @outputs[index][:msg] = 'Table#fields malformed!'
- #end
end
def check_row(line, index)
return unless @outputs[index][:state] == :none
return unless line.include? '%row'
@@ -107,10 +101,10 @@
@outputs[index][:level] = 3
@outputs[index][:state] = :ok
if find_parent(index) != :table
@outputs[index][:state] = :err
@outputs[index][:msg] = 'Parent(concept) not found!'
- elsif !line.start_with? ' %template'
+ elsif !line.match(/^\s\s\s\s\s\s%template\s*/)
@outputs[index][:state] = :err
@outputs[index][:msg] = 'Write 6 spaces before %template'
end
end
end