module Emerald
Parses a context free grammar from the preprocessed emerald and generates html associated with corresponding abstract syntax tree.
Constants
- VERSION
Public Class Methods
convert(input, context = {})
click to toggle source
# File lib/emerald.rb, line 55 def self.convert(input, context = {}) preprocessed_emerald, source_map = PreProcessor.new.process_emerald(input) abstract_syntax_tree = Grammar.parse_grammar( preprocessed_emerald, input, source_map ) return abstract_syntax_tree.to_html(context) end
write_html(html_output, file_name, beautify)
click to toggle source
Write html to file and beautify it if the beautify global option is set to true.
# File lib/emerald.rb, line 68 def self.write_html(html_output, file_name, beautify) File.open(file_name + '.html', 'w') do |emerald_file| html_output = HtmlBeautifier.beautify(html_output) if beautify emerald_file.write(html_output) end puts "Wrote #{file_name + '.html'}" end