Use Standard PageRenderer for S5 Content
This commit is contained in:
commit
ee22cdf75e
|
@ -293,14 +293,10 @@ class WikiController < ApplicationController
|
|||
end
|
||||
|
||||
def s5
|
||||
if @page.revisions.last.content =~ /^slide_theme:\s*([\w\d]+)/
|
||||
@s5_theme = $1
|
||||
else
|
||||
@s5_theme = "default"
|
||||
end
|
||||
|
||||
if @web.markup == :markdownMML || @web.markup == :markdown
|
||||
@s5_content = PageRenderer.new(@page.revisions.last).display_s5
|
||||
my_rendered = PageRenderer.new(@page.revisions.last)
|
||||
@s5_content = my_rendered.display_s5
|
||||
@s5_theme = my_rendered.s5_theme
|
||||
else
|
||||
@s5_content = "S5 not supported with this text filter"
|
||||
end
|
||||
|
|
|
@ -45,14 +45,15 @@ module Engines
|
|||
|
||||
# If the request is for S5, call Maruku accordingly (without math)
|
||||
if @content.options[:mode] == :s5
|
||||
html = Maruku.new(@content.delete("\r"), {:math_enabled => false,
|
||||
my_content = Maruku.new(@content.delete("\r"), {:math_enabled => false,
|
||||
:content_only => true,
|
||||
:author => @content.options[:engine_opts][:author],
|
||||
:title => @content.options[:engine_opts][:title]}).to_s5
|
||||
sanitize_xhtml(html)
|
||||
:title => @content.options[:engine_opts][:title]})
|
||||
@content.options[:renderer].s5_theme = my_content.s5_theme
|
||||
sanitize_xhtml(my_content.to_s5)
|
||||
else
|
||||
html = sanitize_rexml(Maruku.new(@content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
|
||||
{:math_enabled => false}).to_html_tree)
|
||||
sanitize_rexml(Maruku.new(@content.delete("\r"),
|
||||
{:math_enabled => false}).to_html_tree)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -67,18 +68,20 @@ module Engines
|
|||
|
||||
# If the request is for S5, call Maruku accordingly
|
||||
if @content.options[:mode] == :s5
|
||||
html = Maruku.new(@content.delete("\r"), {:math_enabled => true,
|
||||
my_content = Maruku.new(@content.delete("\r"), {:math_enabled => true,
|
||||
:math_numbered => ['\\[','\\begin{equation}'],
|
||||
:content_only => true,
|
||||
:author => @content.options[:engine_opts][:author],
|
||||
:title => @content.options[:engine_opts][:title]}).to_s5
|
||||
sanitize_xhtml(html)
|
||||
:title => @content.options[:engine_opts][:title]})
|
||||
@content.options[:renderer].s5_theme = my_content.s5_theme
|
||||
sanitize_xhtml(my_content.to_s5)
|
||||
else
|
||||
html = sanitize_rexml(Maruku.new(@content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
|
||||
{:math_enabled => true, :math_numbered => ['\\[','\\begin{equation}']}).to_html_tree)
|
||||
html = sanitize_rexml(Maruku.new(@content.delete("\r"),
|
||||
{:math_enabled => true,
|
||||
:math_numbered => ['\\[','\\begin{equation}']}).to_html_tree)
|
||||
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
||||
end
|
||||
|
||||
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -63,11 +63,16 @@ class PageRenderer
|
|||
end
|
||||
end
|
||||
|
||||
attr :s5_theme
|
||||
def s5_theme=(s)
|
||||
@s5_theme = s
|
||||
end
|
||||
|
||||
# Renders an S5 slideshow
|
||||
def display_s5
|
||||
@display_s5 ||= render(:mode => :s5,
|
||||
:engine_opts => { :author => @revision.page.author,
|
||||
:title => @revision.page.plain_name})
|
||||
:title => @revision.page.plain_name}, :renderer => self)
|
||||
end
|
||||
|
||||
# Returns an array of all the WikiIncludes present in the content of this revision.
|
||||
|
|
|
@ -117,7 +117,7 @@ class WikiContent < String
|
|||
|
||||
DEFAULT_OPTS = {
|
||||
:active_chunks => ACTIVE_CHUNKS,
|
||||
:engine => Engines::Textile,
|
||||
:engine => Engines::MarkdownMML,
|
||||
:engine_opts => [],
|
||||
:mode => :show
|
||||
}.freeze
|
||||
|
|
Loading…
Reference in a new issue