Class: ImpressRenderer
- Inherits:
-
Redcarpet::Render::HTML
- Object
- Redcarpet::Render::HTML
- ImpressRenderer
- Defined in:
- lib/impress_renderer.rb
Constant Summary collapse
- @@attrs =
[]
- @@current =
0
Class Method Summary collapse
- .author=(author) ⇒ Object
- .head=(head) ⇒ Object
- .init_with_attrs(_attrs, _opts) ⇒ Object
- .title=(title) ⇒ Object
Instance Method Summary collapse
- #block_code(code, lang) ⇒ Object
- #codespan(code) ⇒ Object
- #doc_footer ⇒ Object
- #doc_header ⇒ Object
- #hrule ⇒ Object
- #mathjax ⇒ Object
Class Method Details
.author=(author) ⇒ Object
13 14 15 |
# File 'lib/impress_renderer.rb', line 13 def self. @@author = "<meta name=\"author\" content=\"#{}\">" end |
.head=(head) ⇒ Object
17 18 19 |
# File 'lib/impress_renderer.rb', line 17 def self.head= head @@head = head end |
.init_with_attrs(_attrs, _opts) ⇒ Object
7 8 9 10 11 |
# File 'lib/impress_renderer.rb', line 7 def self.init_with_attrs _attrs, _opts @@attrs = _attrs @@current = 0 @@opts = _opts end |
.title=(title) ⇒ Object
21 22 23 |
# File 'lib/impress_renderer.rb', line 21 def self.title= title @@title = "<title>#{title}</title>" end |
Instance Method Details
#block_code(code, lang) ⇒ Object
33 34 35 |
# File 'lib/impress_renderer.rb', line 33 def block_code code, lang "<pre><code class='prettyprint #{lang}'>#{code}</code></pre>" end |
#codespan(code) ⇒ Object
37 38 39 |
# File 'lib/impress_renderer.rb', line 37 def codespan code "<code class='inline prettyprint'>#{code}</code>" end |
#doc_footer ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/impress_renderer.rb', line 85 def %{ </div> <script src="js/impress.js"></script> <script>impress().init();</script> </body> </html> } end |
#doc_header ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/impress_renderer.rb', line 54 def doc_header %{<!DOCTYPE html> <html> <head> #{@@title} <link href="css/reset.css" rel="stylesheet" /> #{@@author} <meta charset="utf-8" /> <meta name="viewport" content="width=1024" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <link rel="shortcut icon" href="css/favicon.png" /> <link rel="apple-touch-icon" href="css/apple-touch-icon.png" /> <!-- Code Prettifier: --> <link href="css/highlight.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="js/highlight.pack.js"></script> <script>hljs.initHighlightingOnLoad();</script> #{self.mathjax} <link href="css/style.css" rel="stylesheet" /> #{@@head} </head> <body> <div class="fallback-message"> <p>Your browser <b>doesn't support the features required</b> by impress.js, so you are presented with a simplified version of this presentation.</p> <p>For the best experience please use the latest <b>Chrome</b>, <b>Safari</b> or <b>Firefox</b> browser.</p> </div> <div id="impress"> <div class='step' #{@@attrs[0]}> } end |
#hrule ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/impress_renderer.rb', line 25 def hrule # this is how we later inject attributes into pages. what an awful hack. @@current += 1 %{</div> <div class='step' #{@@attrs[@@current]}> } end |
#mathjax ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/impress_renderer.rb', line 41 def mathjax if @@opts[:latex] %{ <script type="text/x-mathjax-config"> MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}}); </script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script> } end end |