vendor/gems/BlueCloth-1.0.0/lib/bluecloth.rb
### Render Markdown-formatted text in this string object as HTML and return
### it. The parameter is for compatibility with RedCloth, and is currently
### unused, though that may change in the future.
Render Markdown-formatted text in this string object as HTML and return
it. The parameter is for compatibility with RedCloth, and is currently
unused, though that may change in the future.
Render Markdown - formatted text in this string object as HTML and return it . The parameter is for compatibility with RedCloth and is currently unused though that may change in the future .
def to_html( lite=false )
		@scanner = StringScanner::new( '' )
		rs = RenderState::new( {}, {}, {} )
		text = self.gsub( /\r\n?/, "\n" ).detab
		text += "\n\n"
		@log.debug "Normalized line-endings: %p" % text
		if self.filter_html
			text.gsub!( "<", "&lt;" )
			text.gsub!( ">", "&gt;" )
			@log.debug "Filtered HTML: %p" % text
		end
		text.gsub!( /^ +$/, '' )
		@log.debug "Tabs -> spaces/blank lines stripped: %p" % text
		text = hide_html_blocks( text, rs )
		@log.debug "Hid HTML blocks: %p" % text
		@log.debug "Render state: %p" % rs
		text = strip_link_definitions( text, rs )
		@log.debug "Stripped link definitions: %p" % text
		@log.debug "Render state: %p" % rs
		text = escape_special_chars( text )
		@log.debug "Escaped special characters: %p" % text
		text = apply_block_transforms( text, rs )
		@log.debug "After block-level transforms: %p" % text
		text = unescape_special_chars( text )
		@log.debug "After unescaping special characters: %p" % text
		return text
	end
def to_html ( lite = false ) @scanner = StringScanner :: new ( '' ) rs = RenderState :: new ( { } , { } , { } ) text = self . gsub ( / \r \n ? / , "\n" ) . detab text += "\n\n" @log . debug "Normalized line-endings: %p" % text if self . filter_html text . gsub! ( "<" , "&lt;" ) text . gsub! ( ">" , "&gt;" ) @log . debug "Filtered HTML: %p" % text end text . gsub! ( / ^ +$ / , '' ) @log . debug "Tabs -> spaces/blank lines stripped: %p" % text text = hide_html_blocks ( text , rs ) @log . debug "Hid HTML blocks: %p" % text @log . debug "Render state: %p" % rs text = strip_link_definitions ( text , rs ) @log . debug "Stripped link definitions: %p" % text @log . debug "Render state: %p" % rs text = escape_special_chars ( text ) @log . debug "Escaped special characters: %p" % text text = apply_block_transforms ( text , rs ) @log . debug "After block-level transforms: %p" % text text = unescape_special_chars ( text ) @log . debug "After unescaping special characters: %p" % text return text end
Render Markdown-formatted text in this string object as HTML and return
it.
Render Markdown - formatted text in this string object as HTML and return it .
# Create a StringScanner we can reuse for various lexing tasks # Make a structure to carry around stuff that gets placeholdered out of # the source. # Make a copy of the string with normalized line endings, tabs turned to # spaces, and a couple of guaranteed newlines at the end # Filter HTML if we're asked to do so # Simplify blank lines # Replace HTML blocks with placeholders # Strip link definitions, store in render state # Escape meta-characters # Transform block-level constructs # Now swap back in all the escaped characters
lite
<not_specific>