2007-01-22 14:43:50 +01:00
|
|
|
require 'chunks/chunk'
|
2008-05-22 16:36:23 +02:00
|
|
|
require 'sanitize'
|
2007-01-22 14:43:50 +01:00
|
|
|
|
|
|
|
# This chunks allows certain parts of a wiki page to be hidden from the
|
|
|
|
# rest of the rendering pipeline. It should be run at the beginning
|
|
|
|
# of the pipeline in `wiki_content.rb`.
|
|
|
|
#
|
|
|
|
# An example use of this chunk is to markup double brackets or
|
|
|
|
# auto URI links:
|
|
|
|
# <nowiki>Here are [[double brackets]] and a URI: www.uri.org</nowiki>
|
|
|
|
#
|
|
|
|
# The contents of the chunks will not be processed by any other chunk
|
|
|
|
# so the `www.uri.org` and the double brackets will appear verbatim.
|
|
|
|
#
|
|
|
|
# Author: Mark Reid <mark at threewordslong dot com>
|
|
|
|
# Created: 8th June 2004
|
2007-09-11 05:35:50 +02:00
|
|
|
|
2007-01-22 14:43:50 +01:00
|
|
|
class NoWiki < Chunk::Abstract
|
|
|
|
|
2008-05-21 09:06:31 +02:00
|
|
|
include Sanitize
|
|
|
|
|
2007-01-22 14:43:50 +01:00
|
|
|
NOWIKI_PATTERN = Regexp.new('<nowiki>(.*?)</nowiki>', Regexp::MULTILINE)
|
|
|
|
def self.pattern() NOWIKI_PATTERN end
|
|
|
|
|
|
|
|
attr_reader :plain_text
|
|
|
|
|
|
|
|
def initialize(match_data, content)
|
|
|
|
super
|
2008-05-21 09:06:31 +02:00
|
|
|
@plain_text = @unmask_text = sanitize_xhtml(match_data[1])
|
2007-01-22 14:43:50 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|