Sha256: 739ed8cbba9137fdbec68332cc063f27022f8b8f1b3cb6f8c220fd06ae835659
Contents?: true
Size: 572 Bytes
Versions: 6
Compression:
Stored size: 572 Bytes
Contents
require 'active_support/core_ext/string' module Ecrire::Markdown module Nodes class CodeBlock < Node def initialize(language, title, nodes) @content = ERB::Util.html_escape(nodes.join("\n")) @title = title @language = language end def to_s str = "<pre>" str << "<header>#{@title}</header>" str << "<code" unless @language.nil? str << " class='language-#{@language}'>" end str << @content str << "</code></pre>" str end end end end
Version data entries
6 entries across 6 versions & 1 rubygems