Class: Devcenter::Previewer::WebApp
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Devcenter::Previewer::WebApp
- Includes:
- Logger
- Defined in:
- lib/devcenter/previewer/web_app.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Logger
Class Method Details
.send_server_event ⇒ Object
80 81 82 83 84 85 |
# File 'lib/devcenter/previewer/web_app.rb', line 80 def self.send_server_event Devcenter::Logger.log "Serving server side event to #{settings.connections.size} connections" settings.connections.each do |conn| conn << "data: reload\n\n" end end |
Instance Method Details
#parse_article(src_path) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/devcenter/previewer/web_app.rb', line 66 def parse_article(src_path) article = OpenStruct.new src = IO.read(src_path) , article.content = src.split(/\r*\n\r*\n/, 2) article. = OpenStruct.new YAML.load() markdown_flavour = article..markdown_flavour || :maruku begin article.html = ::DevcenterParser.to_html(article.content, markdown_flavour.to_sym) rescue Exception => e article.error = e.to_s end article end |