Sha256: cfbd8632c0b890e86bef14af9faa23e213be34d1e291b210039467383d3ff49a

Contents?: true

Size: 1.42 KB

Versions: 10

Compression:

Stored size: 1.42 KB

Contents

module Smithy
  class Formatter < ::Slodown::Formatter

    def render
      self.complete.to_s
    end

    private
      def kramdown_options
        { coderay_css: 'style' }
      end

      def sanitize_config
        {
          elements: %w(
            p div ul ol li blockquote pre h1 h2 h3 h4 h5 h6 object
            hr param
            a span sub sup strong em abbr code del small big
            br img
          ),
          attributes: {
            :all     => ['class', 'style', 'title', 'id'],
            'a'      => ['href', 'rel', 'name', 'target'],
            'li'     => ['id'],
            'sup'    => ['id'],
            'img'    => ['src', 'title', 'alt', 'width', 'height'],
            'object' => ['width', 'height'],
            'param'  => ['name', 'value'],
            'embed'  => ['allowscriptaccess', 'width', 'height', 'src'],
            'iframe' => ['width', 'height', 'src']
          },
          protocols: {
            'a' => { 'href' => ['ftp', 'http', 'https', 'mailto', '#fn', '#fnref', :relative] },
            'img' => {'src'  => ['http', 'https', :relative]},
            'iframe' => {'src'  => ['http', 'https']},
            'embed' => {'src'  => ['http', 'https']},
            'object' => {'src'  => ['http', 'https']},
            'li' => {'id' => ['fn']},
            'sup' => {'id' => ['fnref']}
          },
          transformers: ::Slodown::EmbedTransformer
        }
      end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
smithycms-0.5.2 lib/smithy/formatter.rb
smithycms-0.6.0 lib/smithy/formatter.rb
smithycms-0.5.1 lib/smithy/formatter.rb
smithycms-0.5.0 lib/smithy/formatter.rb
smithycms-0.4.5 lib/smithy/formatter.rb
smithycms-0.4.4 lib/smithy/formatter.rb
smithycms-0.4.3 lib/smithy/formatter.rb
smithycms-0.4.2 lib/smithy/formatter.rb
smithycms-0.4.1 lib/smithy/formatter.rb
smithycms-0.4.0 lib/smithy/formatter.rb