Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2009-03-02 02:39:23 -06:00
commit 52f57f151c
45 changed files with 872 additions and 751 deletions

View file

@ -105,7 +105,7 @@ module WikiChunk
unless defined? WIKI_LINK
WIKI_LINK = /(":)?\[\[\s*([^\]\s][^\]]*?)\s*\]\]/
LINK_TYPE_SEPARATION = Regexp.new('^(.+):((file)|(pic)|(delete))$', 0)
LINK_TYPE_SEPARATION = Regexp.new('^(.+):((file)|(pic)|(video)|(delete))$', 0)
ALIAS_SEPARATION = Regexp.new('^(.+)\|(.+)$', 0)
WEB_SEPARATION = Regexp.new('^(.+):(.+)$', 0)
end

View file

@ -14,7 +14,7 @@ module Sanitizer
em fieldset font form h1 h2 h3 h4 h5 h6 hr i img input ins kbd label
legend li map menu ol optgroup option p pre q s samp select small span
strike strong sub sup table tbody td textarea tfoot th thead tr tt u
ul var]
ul var video]
mathml_elements = %w[annotation annotation-xml maction math merror mfrac
mfenced mi mmultiscripts mn mo mover mpadded mphantom mprescripts mroot
@ -29,7 +29,7 @@ module Sanitizer
acceptable_attributes = %w[abbr accept accept-charset accesskey action
align alt axis border cellpadding cellspacing char charoff charset
checked cite class clear cols colspan color compact coords datetime
checked cite class clear cols colspan color compact controls coords datetime
dir disabled enctype for frame headers height href hreflang hspace id
ismap label lang longdesc maxlength media method multiple name nohref
noshade nowrap prompt readonly rel rev rows rowspan rules scope

View file

@ -35,6 +35,8 @@ class AbstractUrlGenerator
file_link(mode, name, text, web.address, known_page, description)
when :pic
pic_link(mode, name, text, web.address, known_page)
when :video
video_link(mode, name, text, web.address, known_page)
when :delete
delete_link(mode, name, web.address, known_page)
else
@ -141,6 +143,31 @@ class UrlGenerator < AbstractUrlGenerator
end
end
def video_link(mode, name, text, web_address, known_vid)
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
:id => name
case mode
when :export
if known_vid
%{<video src="#{CGI.escape(name)}" controls="controls">#{text}</video>}
else
text
end
when :publish
if known_vid
%{<video src="#{href}" controls="controls">#{text}</video>}
else
%{<span class="newWikiWord">#{text}</span>}
end
else
if known_vid
%{<video src="#{href}" controls="controls">#{text}</video>}
else
%{<span class="newWikiWord">#{text}<a href="#{href}">?</a></span>}
end
end
end
def delete_link(mode, name, web_address, known_file)
href = @controller.url_for :controller => 'file', :web => web_address,
:action => 'delete', :id => name