Sha256: 5422bf8ef6d06f9cbb0f0d8dca0ca2ee05c14bff113592ac54afceacfa70475a
Contents?: true
Size: 678 Bytes
Versions: 1
Compression:
Stored size: 678 Bytes
Contents
# This chunk is supposed to pick up acronyms that have been defined on another # page and define them on this page. See glossary for more details. class Acronym < Chunk::Abstract def self.pattern() %r{([A-Z]+)(<\/acronym>)?} end def initialize(match_data, revision) super(match_data, revision) @acronym, @defined = match_data[1], match_data[2] end def unmask(content) return self if @defined definitions = revision.page.web.glossary_items.inject({}) { |hsh, (ac,df), pg| hsh[ac] = df } return self if content.gsub!( Regexp.new(mask(content)), "<acronym title='#{definitions[@acronym]}'>#{@acronym}</acronym>" ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Pimki-1.7.092 | app/models/chunks/acronym.rb |