Don't hide equations, except in MarkdownMML and MarkdownPNG
In other engines, e.g. textile, the equation delimiters have no special meaning. So they should not be used to hide content from wiki processing.
This commit is contained in:
parent
a6d80426a9
commit
294ac909c4
|
@ -120,6 +120,7 @@ class WikiContent < String
|
||||||
|
|
||||||
DEFAULT_OPTS = {
|
DEFAULT_OPTS = {
|
||||||
:active_chunks => ACTIVE_CHUNKS,
|
:active_chunks => ACTIVE_CHUNKS,
|
||||||
|
:hide_chunks => HIDE_CHUNKS,
|
||||||
:engine => Engines::MarkdownMML,
|
:engine => Engines::MarkdownMML,
|
||||||
:engine_opts => [],
|
:engine_opts => [],
|
||||||
:mode => :show
|
:mode => :show
|
||||||
|
@ -138,6 +139,8 @@ class WikiContent < String
|
||||||
@options[:engine] = Engines::MAP[@web.markup]
|
@options[:engine] = Engines::MAP[@web.markup]
|
||||||
@options[:engine_opts] = [:filter_html, :filter_styles] if @web.safe_mode?
|
@options[:engine_opts] = [:filter_html, :filter_styles] if @web.safe_mode?
|
||||||
@options[:active_chunks] = (ACTIVE_CHUNKS - [WikiChunk::Word] ) if @web.brackets_only?
|
@options[:active_chunks] = (ACTIVE_CHUNKS - [WikiChunk::Word] ) if @web.brackets_only?
|
||||||
|
@options[:hide_chunks] = (HIDE_CHUNKS - [Literal::Math] ) unless
|
||||||
|
[Engines::MarkdownMML, Engines::MarkdownPNG].include?(@options[:engine])
|
||||||
|
|
||||||
@not_rendered = @pre_rendered = nil
|
@not_rendered = @pre_rendered = nil
|
||||||
|
|
||||||
|
@ -169,7 +172,7 @@ class WikiContent < String
|
||||||
copy = WikiContentStub.new(self, @web, @options)
|
copy = WikiContentStub.new(self, @web, @options)
|
||||||
@options[:engine].apply_to(copy)
|
@options[:engine].apply_to(copy)
|
||||||
|
|
||||||
copy.inside_chunks(HIDE_CHUNKS) do |id|
|
copy.inside_chunks(@options[:hide_chunks]) do |id|
|
||||||
@chunks_by_id[id.to_i].revert
|
@chunks_by_id[id.to_i].revert
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -330,6 +330,15 @@ END_THM
|
||||||
"should we go ThatWay or $ThisWay$.")
|
"should we go ThatWay or $ThisWay$.")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_content_with_wikiword_in_equations_textile
|
||||||
|
set_web_property :markup, :textile
|
||||||
|
assert_markup_parsed_as(
|
||||||
|
"<p>$$<span class='newWikiWord'>foo<a href='../show/foo'>?" +
|
||||||
|
"</a></span>$$<br/>$<span class='newWikiWord'>foo<a " +
|
||||||
|
"href='../show/foo'>?</a></span>$</p>",
|
||||||
|
"$$[[foo]]$$\n$[[foo]]$")
|
||||||
|
end
|
||||||
|
|
||||||
# wikiwords are invalid as styles, must be in "name: value" form
|
# wikiwords are invalid as styles, must be in "name: value" form
|
||||||
def test_content_with_wikiword_in_style_tag
|
def test_content_with_wikiword_in_style_tag
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
|
|
Loading…
Reference in a new issue