class Strelka::CMS::PageFilter::Strip

A class for stripping any remaining processing instructions from a .page file.

Constants

ANY_PI_PATTERN

PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'

Public Instance Methods

process( source, page ) click to toggle source

Process the page's source with the filter and return the altered content.

# File lib/strelka/cms/pagefilter/strip.rb, line 17
def process( source, page )
        self.log.debug "Stripping out any remaining PIs"
        comments = page.options['comment_stripped_pis']
        return source.gsub( ANY_PI_PATTERN ) do |m|
                if comments
                        "<!-- Stripped PI: #$1 -->"
                else
                        ''
                end
        end
end