Render S5 slideshows using Instiki's rendering engine framework so that WikiWord links are processed.
This commit is contained in:
parent
cbb3d5f256
commit
b8911bc388
|
@ -293,21 +293,16 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def s5
|
def s5
|
||||||
if @web.markup == :markdownMML
|
if @page.revisions.last =~ /^slide_theme:\s*(.+)$/
|
||||||
my_content = Maruku.new(@page.content.delete("\r"),
|
@s5_theme = $1
|
||||||
{:math_enabled => true, :math_numbered => ['\\[','\\begin{equation}'], :content_only => true,
|
else
|
||||||
:author => @page.author, :title => @page.plain_name})
|
@s5_theme = "default"
|
||||||
@s5_content = sanitize_xhtml(my_content.to_s5)
|
end
|
||||||
@s5_theme = my_content.s5_theme
|
|
||||||
elsif @web.markup == :markdown
|
if @web.markup == :markdownMML || @web.markup == :markdown
|
||||||
my_content = Maruku.new(@page.content.delete("\r"),
|
@s5_content = PageRenderer.new(@page.revisions.last).display_s5
|
||||||
{:math_enabled => false, :content_only => true,
|
|
||||||
:author => @page.author, :title => @page.plain_name})
|
|
||||||
@s5_content = sanitize_xhtml(my_content.to_s5)
|
|
||||||
@s5_theme = my_content.s5_theme
|
|
||||||
else
|
else
|
||||||
@s5_content = "S5 not supported with this text filter"
|
@s5_content = "S5 not supported with this text filter"
|
||||||
@s5_theme = "default"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,19 @@ module Engines
|
||||||
def mask
|
def mask
|
||||||
require 'maruku'
|
require 'maruku'
|
||||||
require 'maruku/ext/math'
|
require 'maruku/ext/math'
|
||||||
|
|
||||||
|
# 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,
|
||||||
|
:content_only => true,
|
||||||
|
:author => @content.options[:engine_opts][:author],
|
||||||
|
:title => @content.options[:engine_opts][:title]}).to_s5
|
||||||
|
sanitize_xhtml(html)
|
||||||
|
else
|
||||||
html = sanitize_rexml(Maruku.new(@content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
|
html = sanitize_rexml(Maruku.new(@content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
|
||||||
{:math_enabled => false}).to_html_tree)
|
{:math_enabled => false}).to_html_tree)
|
||||||
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,8 +64,20 @@ module Engines
|
||||||
def mask
|
def mask
|
||||||
require 'maruku'
|
require 'maruku'
|
||||||
require 'maruku/ext/math'
|
require 'maruku/ext/math'
|
||||||
|
|
||||||
|
# If the request is for S5, call Maruku accordingly
|
||||||
|
if @content.options[:mode] == :s5
|
||||||
|
html = 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)
|
||||||
|
else
|
||||||
html = sanitize_rexml(Maruku.new(@content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
|
html = sanitize_rexml(Maruku.new(@content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
|
||||||
{:math_enabled => true, :math_numbered => ['\\[','\\begin{equation}']}).to_html_tree)
|
{:math_enabled => true, :math_numbered => ['\\[','\\begin{equation}']}).to_html_tree)
|
||||||
|
end
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -63,6 +63,13 @@ class PageRenderer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Renders an S5 slideshow
|
||||||
|
def display_s5
|
||||||
|
@display_s5 ||= render(:mode => :s5,
|
||||||
|
:engine_opts => { :author => @revision.page.author,
|
||||||
|
:title => @revision.page.plain_name})
|
||||||
|
end
|
||||||
|
|
||||||
# Returns an array of all the WikiIncludes present in the content of this revision.
|
# Returns an array of all the WikiIncludes present in the content of this revision.
|
||||||
def wiki_includes
|
def wiki_includes
|
||||||
unless @wiki_includes_cache
|
unless @wiki_includes_cache
|
||||||
|
|
Loading…
Reference in a new issue