vendor/gems/BlueCloth-1.0.0/lib/bluecloth.rb
### Escape special characters in the given +str+
Escape special characters in the given +str+
Escape special characters in the given + str +
def escape_special_chars( str )
		@log.debug "  Escaping special characters"
		text = ''
		tokenize_html( str ) {|token, str|
			@log.debug "   Adding %p token %p" % [ token, str ]
			case token
			when :tag
				text += str.
					gsub( /\*/, EscapeTable['*'][:md5] ).
					gsub( /_/, EscapeTable['_'][:md5] )
			when :text
				text += encode_backslash_escapes( str )
			else
				raise TypeError, "Unknown token type %p" % token
			end
		}
		@log.debug "  Text with escapes is now: %p" % text
		return text
	end
def escape_special_chars ( str ) @log . debug "  Escaping special characters" text = '' tokenize_html ( str ) { | token , str | @log . debug "   Adding %p token %p" % [ token , str ] case token when :tag text += str . gsub ( / \* / , EscapeTable [ '*' ] [ :md5 ] ) . gsub ( / _ / , EscapeTable [ '_' ] [ :md5 ] ) when :text text += encode_backslash_escapes ( str ) else raise TypeError , "Unknown token type %p" % token end } @log . debug "  Text with escapes is now: %p" % text return text end
Escape special characters in the given +str+
Escape special characters in the given + str +
# The original Markdown source has something called '$tags_to_skip' # declared here, but it's never used, so I don't define it. # Within tags, encode * and _ # Encode backslashed stuff in regular text
str
<not_specific>