[BREAKS BUILD] Links to pictures. Problem is, URIChunk thinks that index.jpg is a hyperlink to http://index.jp.

Also, commented out the code that was hiding rendering errors. This should be done at a different level.
This commit is contained in:
Alexey Verkhovsky 2005-01-23 03:27:45 +00:00
parent 1d82582c3b
commit d6fe54f4ad
9 changed files with 114 additions and 55 deletions

View file

@ -18,21 +18,30 @@ module Chunk
# in this content with its mask.
def self.apply_to(content)
content.gsub!( self.pattern ) do |match|
content.chunks << self.new($~)
content.chunks.last.mask(content)
new_chunk = self.new($~)
content.chunks << new_chunk
new_chunk.mask(content)
end
end
def pre_mask()
"chunk#{self.object_id}start "
def pre_mask
"chunk#{self.object_id}#{self.class.to_s.delete(':').downcase}start"
end
def post_mask()
" chunk#{self.object_id}end"
def post_mask
"chunk#{self.object_id}end"
end
def bracketing_mask(content)
"#{pre_mask} #{content} #{post_mask}"
end
def bracketing_mask_regexp
Regexp.new("#{pre_mask} (.*)[ \n]#{post_mask}")
end
def mask(content)
"chunk#{self.object_id}chunk"
"chunk#{self.object_id}#{self.class.to_s.delete(':').downcase}chunk"
end
def revert(content)

View file

@ -38,10 +38,13 @@ module WikiChunk
# By default, no escaped text
def escaped_text() nil end
# Replace link with a mask, but if the word is escaped, then don't replace it
def mask(content) escaped_text || "#{pre_mask}#{link_text}#{post_mask}" end
# FIXME: do not use the bracketing mask - URI chunk thinks that 'index.jpg'
# contains URL http://index.jp
def regexp() /#{pre_mask}(.*)#{post_mask}/ end
# Replace link with a mask, but if the word is escaped, then don't replace it
def mask(content) escaped_text || bracketing_mask(link_text) end
def regexp() bracketing_mask_regexp end
def revert(content) content.sub!(regexp, text) end