require 'aipim-rails/parser_helper' module Html def self.get_tag_color(str, word, classname) str.gsub(word,''+word+'') end def self.get_tag_quotes(str) quotes = [] tquotes = str.scan(/"([^"]*)"/) tquotes.each { |t| quotes << t[0] } quotes = quotes.uniq quotes.each { |t| str = str.gsub('"'+t+'"', '"'+t+'"') } str end def self.colorize(str) str = get_tag_quotes(str) str = get_tag_color(str, "Dado ", "tag-given") str = get_tag_color(str, "Quando ", "tag-when") str = get_tag_color(str, "Então ", "tag-then") str = get_tag_color(str, "E ", "tag-and") end def self.index(features) output = File.open("aipim/html/index.html", "w") output.puts '
' output.close end def self.features(features) features.each_with_index do |feature, i| output = File.open("aipim/html/"+feature[:filename]+".html", "w") output.puts '
' feature[:scenarios].each_with_index do |scenario,j| output.puts '

'+(i+1).to_s+'.'+(j+1).to_s+'. '+scenario[:name]+'[índice]

' end output.puts ' ' output.close end end end