Sha256: a703fc25a944ab00db69298d7e08da6ad60a3b88fa1d10a4542e9f322cda9f65

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'redcarpet'
class ImpressRenderer < Redcarpet::Render::HTML
  @@attrs = []
  @@current = 0

  def self.init_with_attrs att
    @@attrs = att
    @@current = 0
  end

  def hrule
    # this is how we later inject attributes into pages. what an awful hack.
    @@current += 1
    %{</div>
      <div class='step' #{@@attrs[@@current]}>
    }
  end

  def block_code code, lang
    "<pre><code class='prettyprint'>#{code}</code></pre>"
  end

  def codespan code
    "<code class='inline prettyprint'>#{code}</code>"
  end

  def doc_header
    %{
<html>
  <head>
    <link href="css/reset.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400' rel='stylesheet' type='text/css'>    
    <!-- Code Prettifier: -->
<link href="css/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/prettify.js"></script>    
  </head>

  <body onload="prettyPrint()">
    <div id="impress">
    <div class='step' #{@@attrs[0]}>
    }
  end

  def doc_footer
    %{
      </div>
    <script src="js/impress.js"></script>
    <script>impress();</script>
  </body>
</html>
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mdpress-0.0.3 lib/impress_renderer.rb
mdpress-0.0.2 lib/impress_renderer.rb