public Method

BlueCloth.transform_list_items( str, rs )

Transform list items in a copy of the given str and return it.

Source Code

# File bluecloth.rb, line 515
def transform_list_items( str, rs )
        @log.debug " Transforming list items"

        # Trim trailing blank lines
        str = str.sub( /\n{2,}\z/, "\n" )

        str.gsub( ListItemRegexp ) {|line|
                @log.debug "  Found item line %p" % line
                leading_line, item = $1, $4

                if leading_line or /\n{2,}/.match( item )
                        @log.debug "   Found leading line or item has a blank"
                        item = apply_block_transforms( outdent(item), rs )
                else
                        # Recursion for sub-lists
                        @log.debug "   Recursing for sublist"
                        item = transform_lists( outdent(item), rs ).chomp
                        item = apply_span_transforms( item, rs )
                end

                %{<li>%s</li>\n} % item
        }
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.