Sha256: d75fec2097199fae9e4a473ea8f982646a21835f3d09b41ce9891d736c25a306
Contents?: true
Size: 769 Bytes
Versions: 6
Compression:
Stored size: 769 Bytes
Contents
#!/usr/bin/env ruby require 'strelka/cms/pagefilter' unless defined?( Strelka::CMS::PageFilter ) # A class for stripping any remaining processing instructions from a .page file. class Strelka::CMS::PageFilter::Strip < Strelka::CMS::PageFilter # PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' ANY_PI_PATTERN = %r{ <\? (.*?) # PI content \?> }x ### Process the +page+'s source with the filter and return the altered content. 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 end # class Strelka::CMS::Page::StripFilter
Version data entries
6 entries across 6 versions & 1 rubygems