vendor/gems/BlueCloth-1.0.0/lib/bluecloth.rb
### Turn image markup into image tags.
Turn image markup into image tags.
Turn image markup into image tags .
def transform_images( str, rs )
		@log.debug " Transforming images" % str
		str.
			gsub( ReferenceImageRegexp ) {|match|
				whole, alt, linkid = $1, $2, $3.downcase
				@log.debug "Matched %p" % match
				res = nil
				alt.gsub!( /"/, '&quot;' )
				linkid = alt.downcase if linkid.empty?
				if rs.urls.key?( linkid )
					url = escape_md( rs.urls[linkid] )
					@log.debug "Found url '%s' for linkid '%s' " % [ url, linkid ]
					result = %{<img src="%s" alt="%s"} % [ url, alt ]
					if rs.titles.key?( linkid )
						result += %{ title="%s"} % escape_md( rs.titles[linkid] )
					end
					result += EmptyElementSuffix
				else
					result = whole
				end
				@log.debug "Replacing %p with %p" % [ match, result ]
				result
			}.
			gsub( InlineImageRegexp ) {|match|
				@log.debug "Found inline image %p" % match
				whole, alt, title = $1, $2, $5
				url = escape_md( $3 )
				alt.gsub!( /"/, '&quot;' )
				result = %{<img src="%s" alt="%s"} % [ url, alt ]
				unless title.nil?
					title.gsub!( /"/, '&quot;' )
					result += %{ title="%s"} % escape_md( title )
				end
				result += EmptyElementSuffix
				@log.debug "Replacing %p with %p" % [ match, result ]
				result
			}
	end
def transform_images ( str , rs ) @log . debug " Transforming images" % str str . gsub ( ReferenceImageRegexp ) { | match | whole , alt , linkid = $1 , $2 , $3 . downcase @log . debug "Matched %p" % match res = nil alt . gsub! ( / " / , '&quot;' ) linkid = alt . downcase if linkid . empty? if rs . urls . key? ( linkid ) url = escape_md ( rs . urls [ linkid ] ) @log . debug "Found url '%s' for linkid '%s' " % [ url , linkid ] result = %{<img src="%s" alt="%s"} % [ url , alt ] if rs . titles . key? ( linkid ) result += %{ title="%s"} % escape_md ( rs . titles [ linkid ] ) end result += EmptyElementSuffix else result = whole end @log . debug "Replacing %p with %p" % [ match , result ] result } . gsub ( InlineImageRegexp ) { | match | @log . debug "Found inline image %p" % match whole , alt , title = $1 , $2 , $5 url = escape_md ( $3 ) alt . gsub! ( / " / , '&quot;' ) result = %{<img src="%s" alt="%s"} % [ url , alt ] unless title . nil? title . gsub! ( / " / , '&quot;' ) result += %{ title="%s"} % escape_md ( title ) end result += EmptyElementSuffix @log . debug "Replacing %p with %p" % [ match , result ] result } end
Turn image markup into image tags.
Turn image markup into image tags .
# Handle reference-style labeled images: ![alt text][id] # for shortcut links like ![this][]. # Build the tag # Inline image style # Build the tag
str
<not_specific>
rs
<not_specific>