Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
f23e1487df
|
@ -45,12 +45,11 @@ module Chunk
|
||||||
|
|
||||||
# Find all the chunks of the given type in content
|
# Find all the chunks of the given type in content
|
||||||
# Each time the pattern is matched, create a new
|
# Each time the pattern is matched, create a new
|
||||||
# chunk for it, and replace the occurance of the chunk
|
# chunk for it, and replace the occurrence of the chunk
|
||||||
# in this content with its mask.
|
# in this content with its mask.
|
||||||
def self.apply_to(content)
|
def self.apply_to(content)
|
||||||
text = content.to_str
|
text = content.to_str
|
||||||
text.gsub!( self.pattern ) do |match|
|
text.gsub!( self.pattern ) do |match|
|
||||||
# content.replace text
|
|
||||||
new_chunk = self.new($~, content)
|
new_chunk = self.new($~, content)
|
||||||
content.add_chunk(new_chunk)
|
content.add_chunk(new_chunk)
|
||||||
new_chunk.mask
|
new_chunk.mask
|
||||||
|
|
|
@ -71,9 +71,11 @@ module Engines
|
||||||
@content.options[:renderer].s5_theme = my_content.s5_theme
|
@content.options[:renderer].s5_theme = my_content.s5_theme
|
||||||
my_content.to_s5
|
my_content.to_s5
|
||||||
else
|
else
|
||||||
|
(t = Time.now; nil)
|
||||||
html = Maruku.new(@content.delete("\r").to_utf8,
|
html = Maruku.new(@content.delete("\r").to_utf8,
|
||||||
{:math_enabled => true,
|
{:math_enabled => true,
|
||||||
:math_numbered => ['\\[','\\begin{equation}']}).to_html
|
:math_numbered => ['\\[','\\begin{equation}']}).to_html
|
||||||
|
(ApplicationController.logger.info("Maruku took " + (Time.now-t).to_s + " seconds."); nil)
|
||||||
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,7 @@ require_dependency 'chunks/literal'
|
||||||
require 'chunks/nowiki'
|
require 'chunks/nowiki'
|
||||||
require 'sanitizer'
|
require 'sanitizer'
|
||||||
require 'instiki_stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
require 'set'
|
||||||
|
|
||||||
|
|
||||||
# Wiki content is just a string that can process itself with a chain of
|
# Wiki content is just a string that can process itself with a chain of
|
||||||
|
@ -53,10 +54,10 @@ module ChunkManager
|
||||||
def init_chunk_manager
|
def init_chunk_manager
|
||||||
@chunks_by_type = Hash.new
|
@chunks_by_type = Hash.new
|
||||||
Chunk::Abstract::derivatives.each{|chunk_type|
|
Chunk::Abstract::derivatives.each{|chunk_type|
|
||||||
@chunks_by_type[chunk_type] = Array.new
|
@chunks_by_type[chunk_type] = Set.new
|
||||||
}
|
}
|
||||||
@chunks_by_id = Hash.new
|
@chunks_by_id = Hash.new
|
||||||
@chunks = []
|
@chunks = Set.new
|
||||||
@chunk_id = 0
|
@chunk_id = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue