Sha256: 07b3df2e9a4b0d09000476ed63828d9bd00dd8819908c0630fd9e4ed4d2059a3
Contents?: true
Size: 1.36 KB
Versions: 13
Compression:
Stored size: 1.36 KB
Contents
require 'net/http' require 'buzzcore/misc_utils' require 'buzzcore/xml_utils' module HtmlUtils #browser-safe inline block INLINE_BLOCK_SAFE_STYLE = "display: -moz-inline-box; display: inline-block; zoom: 1; *display:inline" # see fixed_frame_image RIGID_CRR_BLOCK_STYLE = "margin: 0; padding: 0; position: relative; top: 0pt; left: 0pt; display: table-cell; vertical-align: middle; overflow: hidden" IMAGE_CRD_STYLE = "display: block; margin: auto; vertical-align: middle;" def self.fixed_frame_image(aImgTag,aFrameW,aFrameH,aImgW=nil,aImgH=nil) style = RIGID_CRR_BLOCK_STYLE+";width: #{aFrameW}px; height: #{aFrameH}px" result = "<div style=\"#{INLINE_BLOCK_SAFE_STYLE}\"><div style=\"#{style}\">" aImgTag = XmlUtils.quick_remove_att(aImgTag,'width') if aImgW aImgTag = XmlUtils.quick_remove_att(aImgTag,'height') if aImgH style = XmlUtils.quick_att_from_tag(aImgTag,'style').to_s style += IMAGE_CRD_STYLE style += ";width: #{aImgW}px; height: #{aImgH}px" aImgTag = XmlUtils.quick_set_att(aImgTag,'style',style) result << aImgTag result << "</div></div>" result end def self.gen_seo_title(*aValues) aValues = [aValues] unless aValues.is_a? Array aValues = aValues.map {|f| f.to_s.strip } aValues.delete_if {|v| v.empty? } aValues.join(' ').gsub(/ {2,}/,' ') end def self.url_name_from(*aValues) gen_seo_title(*aValues).urlize end end
Version data entries
13 entries across 13 versions & 1 rubygems