Class: Markyboot::Document
- Inherits:
-
Object
- Object
- Markyboot::Document
- Defined in:
- lib/markyboot.rb
Instance Attribute Summary collapse
-
#html ⇒ Object
Returns the value of attribute html.
Instance Method Summary collapse
-
#initialize(contents) ⇒ Document
constructor
A new instance of Document.
- #layout ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(contents) ⇒ Document
Returns a new instance of Document.
12 13 14 15 |
# File 'lib/markyboot.rb', line 12 def initialize(contents) marker = Redcarpet::Markdown.new(HTMLwithAlbino, :fenced_code_blocks => true) @html = marker.render(contents) end |
Instance Attribute Details
#html ⇒ Object
Returns the value of attribute html.
10 11 12 |
# File 'lib/markyboot.rb', line 10 def html @html end |
Instance Method Details
#layout ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/markyboot.rb', line 17 def layout layout = <<-HTML.gsub(/^ {6}/, '') <!DOCTYPE html> <html lang="en"> <head> <title>Preview</title> <meta charset="utf-8"> <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" /> <link rel="stylesheet" href="http://yandex.st/highlightjs/6.1/styles/zenburn.min.css" /> <style type="text/css"> body { background-color: #eee; } .container { background-color: #fff; width: 650px; margin: 2em auto; padding: 2em; } pre code.ruby { line-height: 1.45em; } </style> </head> <body> <div class="container"> REPLACE_ME </div> <script src="http://yandex.st/highlightjs/6.1/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> </body> </html> HTML layout end |
#render ⇒ Object
53 54 55 |
# File 'lib/markyboot.rb', line 53 def render layout.gsub(/REPLACE_ME/, @html) end |