More progress on S5.
Forgot to add gremlin zapping in app/views/wiki/edit.rhtml.
This commit is contained in:
parent
8359047fd5
commit
02c6ed2fa0
|
@ -2,6 +2,7 @@ require 'fileutils'
|
||||||
require 'redcloth_for_tex'
|
require 'redcloth_for_tex'
|
||||||
require 'parsedate'
|
require 'parsedate'
|
||||||
require 'zip/zip'
|
require 'zip/zip'
|
||||||
|
require 'sanitize'
|
||||||
|
|
||||||
class WikiController < ApplicationController
|
class WikiController < ApplicationController
|
||||||
|
|
||||||
|
@ -11,6 +12,8 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
layout 'default', :except => [:rss_feed, :rss_with_content, :rss_with_headlines, :tex, :pdf, :s5, :export_tex, :export_html]
|
layout 'default', :except => [:rss_feed, :rss_with_content, :rss_with_headlines, :tex, :pdf, :s5, :export_tex, :export_html]
|
||||||
|
|
||||||
|
include Sanitize
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if @web_name
|
if @web_name
|
||||||
redirect_home
|
redirect_home
|
||||||
|
@ -287,7 +290,9 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def s5
|
def s5
|
||||||
if @web.markup == :markdownMML or @web.markup == :markdown
|
if @web.markup == :markdownMML or @web.markup == :markdown
|
||||||
@s5_content = Maruku.new(@page.content).to_s5
|
# @s5_content = sanitize_html(Maruku.new(@page.content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"), {:raw => true}).to_s5)
|
||||||
|
@s5_content = sanitize_html(Maruku.new(@page.content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
|
||||||
|
{:math_enabled => true, :math_numbered => ['\\[','\\begin{equation}'], :content_only => true}).to_s5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
1
app/views/layouts/s5.rhtml
Normal file
1
app/views/layouts/s5.rhtml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<%= @content_for_layout %>
|
|
@ -14,7 +14,7 @@
|
||||||
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
|
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
|
||||||
'accept-charset' => 'utf-8' }) %>
|
'accept-charset' => 'utf-8' }) %>
|
||||||
|
|
||||||
<textarea name="content" id="content"><%= h(@flash[:content] || @page.content) %></textarea>
|
<textarea name="content" id="content"><%= h(@flash[:content] || @page.content.delete("\x01-\x08\x0B\x0C\x0E-\x1F")) %></textarea>
|
||||||
<div id="editFormButtons">
|
<div id="editFormButtons">
|
||||||
<input type="submit" value="Submit" accesskey="s"/> as
|
<input type="submit" value="Submit" accesskey="s"/> as
|
||||||
<%= text_field_tag :author, @author,
|
<%= text_field_tag :author, @author,
|
||||||
|
|
31
app/views/wiki/s5.rhtml
Normal file
31
app/views/wiki/s5.rhtml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" >
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title><%=@page.plain_name%></title>
|
||||||
|
<!-- metadata -->
|
||||||
|
<meta name="generator" content="Instiki" />
|
||||||
|
<meta name="version" content="<%= "#{Instiki::VERSION::STRING}" %>" />
|
||||||
|
<meta name="author" content="<%=@page.author%>" />
|
||||||
|
<meta name="company" content="" />
|
||||||
|
<!-- configuration parameters -->
|
||||||
|
<meta name="defaultView" content="slideshow" />
|
||||||
|
<meta name="controlVis" content="hidden" />
|
||||||
|
<!-- style sheet links -->
|
||||||
|
<link rel="stylesheet" href="/s5/ui/default/slides.css" type="text/css" media="projection" id="slideProj" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/s5/ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
|
||||||
|
<link rel="stylesheet" href="/s5/ui/default/print.css" type="text/css" media="print" id="slidePrint" />
|
||||||
|
<link rel="stylesheet" href="/s5/ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
|
||||||
|
<link rel="stylesheet" href="/s5/ui/default/math.css" type="text/css" media="all" id="mathStyle" />
|
||||||
|
|
||||||
|
<!-- S5 JS -->
|
||||||
|
<script src="/s5/ui/default/slides.js" type="text/javascript"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<%= @s5_content %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
5
public/s5/ui/default/math.css
Normal file
5
public/s5/ui/default/math.css
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
merror {display:inline;font-size:1em;}
|
||||||
|
math[display=block] {overflow:auto;}
|
||||||
|
math { white-space: nowrap }
|
||||||
|
.maruku-eq-number {float:right}
|
||||||
|
.blockquotesource {margin-left:1em;}
|
|
@ -530,9 +530,9 @@ function notOperaFix() {
|
||||||
slides.setAttribute('href',slideCSS); // Gecko fix
|
slides.setAttribute('href',slideCSS); // Gecko fix
|
||||||
}
|
}
|
||||||
if (isIE && document.styleSheets && document.styleSheets[0]) {
|
if (isIE && document.styleSheets && document.styleSheets[0]) {
|
||||||
document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
|
document.styleSheets[0].addRule('img', 'behavior: url(/s5/ui/default/iepngfix.htc)');
|
||||||
document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
|
document.styleSheets[0].addRule('div', 'behavior: url(/s5/ui/default/iepngfix.htc)');
|
||||||
document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
|
document.styleSheets[0].addRule('.slide', 'behavior: url(/s5/ui/default/iepngfix.htc)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ function createNotesWindow() { // creates a window for our notes
|
||||||
if (!s5NotesWindow || s5NotesWindow.closed) { // Create the window if it doesn't exist
|
if (!s5NotesWindow || s5NotesWindow.closed) { // Create the window if it doesn't exist
|
||||||
s5NotesWindowLoaded = false;
|
s5NotesWindowLoaded = false;
|
||||||
// Note: Safari has a tendency to ignore window options preferring to default to the settings of the parent window, grr.
|
// Note: Safari has a tendency to ignore window options preferring to default to the settings of the parent window, grr.
|
||||||
s5NotesWindow = window.open('ui/s5-notes.html', 's5NotesWindow', 'top=0,left=0');
|
s5NotesWindow = window.open('/s5/ui/s5-notes.html', 's5NotesWindow', 'top=0,left=0');
|
||||||
}
|
}
|
||||||
if (s5NotesWindowLoaded) { // Load the current note if the Note HTML has loaded
|
if (s5NotesWindowLoaded) { // Load the current note if the Note HTML has loaded
|
||||||
loadNote();
|
loadNote();
|
||||||
|
@ -809,4 +809,4 @@ function startup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = startup;
|
window.onload = startup;
|
||||||
window.onresize = function(){setTimeout('windowChange()',5);}
|
window.onresize = function(){setTimeout('windowChange()',5);}
|
||||||
|
|
|
@ -7,13 +7,17 @@ module MaRuKu
|
||||||
def to_s5(context={})
|
def to_s5(context={})
|
||||||
indent = context[:indent] || -1
|
indent = context[:indent] || -1
|
||||||
ie_hack = context[:ie_hack] ||true
|
ie_hack = context[:ie_hack] ||true
|
||||||
|
content_only = true #context[:content_only]
|
||||||
|
|
||||||
doc = Document.new(nil,{:respect_whitespace =>:all})
|
doc = Document.new(nil,{:respect_whitespace =>:all})
|
||||||
html = Element.new('html', doc)
|
if (content_only)
|
||||||
html.add_namespace('http://www.w3.org/1999/xhtml')
|
body = Element.new('div', doc)
|
||||||
html.add_namespace('svg', "http://www.w3.org/2000/svg" )
|
else
|
||||||
|
html = Element.new('html', doc)
|
||||||
|
html.add_namespace('http://www.w3.org/1999/xhtml')
|
||||||
|
html.add_namespace('svg', "http://www.w3.org/2000/svg" )
|
||||||
|
|
||||||
head = Element.new('head', html)
|
head = Element.new('head', html)
|
||||||
me = Element.new 'meta', head
|
me = Element.new 'meta', head
|
||||||
me.attributes['http-equiv'] = 'Content-type'
|
me.attributes['http-equiv'] = 'Content-type'
|
||||||
me.attributes['content'] = 'text/html;charset=utf-8'
|
me.attributes['content'] = 'text/html;charset=utf-8'
|
||||||
|
@ -25,7 +29,8 @@ module MaRuKu
|
||||||
title << Text.new(doc_title)
|
title << Text.new(doc_title)
|
||||||
|
|
||||||
|
|
||||||
body = Element.new('body', html)
|
body = Element.new('body', html)
|
||||||
|
end
|
||||||
|
|
||||||
slide_header = self.attributes[:slide_header]
|
slide_header = self.attributes[:slide_header]
|
||||||
slide_footer = self.attributes[:slide_footer]
|
slide_footer = self.attributes[:slide_footer]
|
||||||
|
@ -35,16 +40,18 @@ module MaRuKu
|
||||||
slide_bottomright = self.attributes[:slide_bottomright]
|
slide_bottomright = self.attributes[:slide_bottomright]
|
||||||
|
|
||||||
dummy_layout_slide =
|
dummy_layout_slide =
|
||||||
"<div class='layout'>
|
"
|
||||||
<div id='controls'><!-- DO NOT EDIT --></div>
|
<div class='layout'>
|
||||||
<div id='currentSlide'><!-- DO NOT EDIT --></div>
|
<div id='controls'></div>
|
||||||
<div id='header'> #{slide_header}</div>
|
<div id='currentSlide'></div>
|
||||||
<div id='footer'> #{slide_footer}</div>
|
<div id='header'> #{slide_header}</div>
|
||||||
<div class='topleft'> #{slide_topleft}</div>
|
<div id='footer'> #{slide_footer}</div>
|
||||||
<div class='topright'> #{slide_topright}</div>
|
<div class='topleft'> #{slide_topleft}</div>
|
||||||
<div class='bottomleft'> #{slide_bottomleft}</div>
|
<div class='topright'> #{slide_topright}</div>
|
||||||
<div class='bottomright'> #{slide_bottomright}</div>
|
<div class='bottomleft'> #{slide_bottomleft}</div>
|
||||||
</div>"
|
<div class='bottomright'> #{slide_bottomright}</div>
|
||||||
|
</div>
|
||||||
|
"
|
||||||
body.add_element Document.new(dummy_layout_slide, {:respect_whitespace =>:all}).root
|
body.add_element Document.new(dummy_layout_slide, {:respect_whitespace =>:all}).root
|
||||||
|
|
||||||
presentation = Element.new 'div', body
|
presentation = Element.new 'div', body
|
||||||
|
@ -82,23 +89,23 @@ module MaRuKu
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
doc2 = Document.new("<div>"+S5_external+"</div>",{:respect_whitespace =>:all})
|
|
||||||
doc2.root.children.each{ |child| head << child }
|
|
||||||
|
|
||||||
|
|
||||||
add_css_to(head)
|
|
||||||
|
|
||||||
xml = ""
|
xml = ""
|
||||||
|
if (content_only)
|
||||||
|
body.write(xml,indent,transitive=true,ie_hack);
|
||||||
|
else
|
||||||
|
doc2 = Document.new("<div>"+S5_external+"</div>",{:respect_whitespace =>:all})
|
||||||
|
doc2.root.children.each{ |child| head << child }
|
||||||
|
|
||||||
# REXML Bug? if indent!=-1 whitespace is not respected for 'pre' elements
|
add_css_to(head)
|
||||||
# containing code.
|
|
||||||
html.write(xml,indent,transitive=true,ie_hack);
|
|
||||||
|
|
||||||
Xhtml10strict + xml
|
# REXML Bug? if indent!=-1 whitespace is not respected for 'pre' elements
|
||||||
|
# containing code.
|
||||||
|
html.write(xml,indent,transitive=true,ie_hack);
|
||||||
|
Xhtml10strict + xml
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue