Sha256: 48e1530811057a3a4a3934651344d361e17a3dfd2b44aa928845cef875582511

Contents?: true

Size: 804 Bytes

Versions: 3

Compression:

Stored size: 804 Bytes

Contents

module ArtiMark
  module Html
    class HeaderWriter
      include Util
      def initialize(generator)
        @generator = generator
        @context = generator.context
        @writers = {
          :stylesheets => proc do |item|
            @context.stylesheets.concat( item[:stylesheets].map do
              |s|
              if s =~ /^(.+?\.css):\((.+?)\)$/
                [$1, $2]
              else
                s
              end
            end)
          end,
          :title => proc do |item|
            @context.title = escape_html item[:title].strip
          end,
          :lang => proc do |item|
            @context.lang = escape_html item[:lang].strip
          end
        }
      end
      def write(item)
        @writers[item[:type]].call item
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arti_mark-0.1.beta3 lib/arti_mark/html/header_writer.rb
arti_mark-0.1.beta2 lib/arti_mark/html/header_writer.rb
arti_mark-0.1.beta1 lib/arti_mark/html/header_writer.rb