class Strelka::CMS::PageFilter::Editorial

A class for embedding editorial remarks in a page.

Constants

LinkPI

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

TOOLTIP_TEMPLATE

Tooltip template

Public Instance Methods

generate_mark( current_page, mark_type, content ) click to toggle source

Create an HTML fragment from the parsed LinkPI.

# File lib/strelka/cms/pagefilter/editorial.rb, line 45
def generate_mark( current_page, mark_type, content )
        id = Digest::MD5.hexdigest( content )

        edmark = %{<span class="edmark %s-edmark">(ed.)</span>} % [ mark_type ]
        tooltip = TOOLTIP_TEMPLATE % [ mark_type, mark_type.upcase, content ]

        return edmark + "\n" + tooltip + "\n"
end
process( source, page ) click to toggle source

Process the given source for <?ed … ?> processing-instructions

# File lib/strelka/cms/pagefilter/editorial.rb, line 33
def process( source, page )
        return source.gsub( LinkPI ) do |match|
                # Grab the tag values
                mark_type = $1
                content   = $2

                self.generate_mark( page, mark_type, content )
        end
end