Sha256: f394ea7c353f465c4267dcbcdc7402294882a3a7cfb91884c45c255822b021a1

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

# -*- coding: utf-8 -*-
#
#--
# Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
# Copyright (C) 2016 Akinori Ichigo <ichigo@shoeisha.co.jp>
# 
# This file is part of kramdown which is licensed under the MIT.
#++
#
#

module Kramdown
  module Utils
    module Html

      def html_attributes(attr)
        return '' if attr.empty?

        attr.map do |k, v|
          if v.nil? || (k == 'id' && v.strip.empty?)
            ''
          elsif k == 'href'
            " #{k}=\"#{v.to_s}\""
          else
            " #{k}=\"#{escape_html(v.to_s, :attribute)}\""
          end
        end.join('')
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
darkmouun-3.2.3 lib/darkmouun/kramdown/utils/html.rb
darkmouun-3.2.2 lib/darkmouun/kramdown/utils/html.rb