Permalink
Browse files

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

  • Loading branch information...
distler committed Jun 25, 2018
2 parents e19cd66 + e2fff0f commit 2d59f5216f073d3025157274e9a09dfce9c56d85
Showing with 18 additions and 23 deletions.
  1. +11 −11 app/controllers/file_controller.rb
  2. +6 −11 lib/chunks/engines.rb
  3. +1 −1 lib/url_generator.rb
@@ -6,7 +6,7 @@
class FileController < ApplicationController
layout 'default'
before_filter :check_authorized
before_filter :check_allow_uploads, :dnsbl_check, :except => [:file, :blahtex_png]
@@ -39,11 +39,11 @@ def file
end
end
end
def blahtex_png
send_file(@web.blahtex_pngs_path.join(params['id']))
end
def delete
@file_name = params['id']
file = WikiFile.find_by_file_name(@file_name)
@@ -59,7 +59,7 @@ def delete
file.destroy
flash[:info] = "File '#{@file_name}' deleted."
else
flash[:error] = "System Password incorrect."
flash[:error] = "System Password incorrect."
end
redirect_to_page(@page_name)
else
@@ -70,7 +70,7 @@ def delete
def cancel_upload
return_to_last_remembered
end
def import
if params['file']
@problems = []
@@ -79,7 +79,7 @@ def import
if @problems.empty?
flash[:info] = 'Import successfully finished'
else
flash[:error] = 'Import finished, but some pages were not imported:<li>' +
flash[:error] = 'Import finished, but some pages were not imported:<li>' +
@problems.join('</li><li>') + '</li>'
end
return_to_last_remembered
@@ -89,12 +89,12 @@ def import
end
protected
def check_authorized
unless authorized? or @web.published?
@hide_navigation = true
render(:status => 403, :text => 'This web is private', :layout => true)
end
end
end
def check_allow_uploads
@@ -110,9 +110,9 @@ def check_allow_uploads
render(:status => 404, :text => "Web #{params['web'].inspect} not found", :layout => 'error')
end
end
private
private
def import_from_archive(archive)
logger.info "Importing pages from #{archive}"
zip = Zip::ZipInputStream.open(archive)
@@ -35,7 +35,7 @@ def mask
redcloth = RedCloth.new(@content, [:hard_breaks] + @content.options[:engine_opts])
redcloth.filter_html = false
redcloth.no_span_caps = false
html = redcloth.to_html(:textile)
redcloth.to_html(:textile)
end
end
@@ -50,8 +50,7 @@ def mask
:title => @content.options[:engine_opts][:title]})
@content.options[:renderer].s5_theme = my_content.s5_theme
else
html = Maruku.new(text, {:math_enabled => false}).to_html
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
Maruku.new(text, {:math_enabled => false}).to_html
end
end
@@ -72,13 +71,10 @@ def mask
@content.options[:renderer].s5_theme = my_content.s5_theme
my_content.to_s5
else
(t = Time.now; nil)
html = Maruku.new(text,
Maruku.new(text,
{:math_enabled => true,
:html_math_generate_ids => false,
:math_numbered => ['\\[','\\begin{equation}']}).to_html
(ApplicationController.logger.info("Maruku took " + (Time.now-t).to_s + " seconds."); nil)
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
end
end
end
@@ -102,15 +98,14 @@ def mask
@content.options[:renderer].s5_theme = my_content.s5_theme
my_content.to_s5
else
html = Maruku.new(text,
Maruku.new(text,
{:math_enabled => true,
:math_numbered => ['\\[','\\begin{equation}'],
:html_math_output_mathml => false,
:html_math_output_png => true,
:html_png_engine => 'blahtex',
:html_png_dir => @content.web.files_path.join('pngs').to_s,
:html_png_url => @content.options[:png_url]}).to_html
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
end
end
end
@@ -121,13 +116,13 @@ def mask
redcloth = OldRedCloth.new(@content.to_str, @content.options[:engine_opts])
redcloth.filter_html = false
redcloth.no_span_caps = false
html = redcloth.to_html
redcloth.to_html
end
end
class RDoc < AbstractEngine
def mask
html = RDocSupport::RDocFormatter.new(@content.as_utf8.to_str).to_html
RDocSupport::RDocFormatter.new(@content.as_utf8.to_str).to_html
end
end
@@ -271,6 +271,6 @@ def wikilink_for(mode, name, anchor_name, text, web_address)
def html_ext
@html_ext ||= @controller.method(:html_ext).call
# Why method().call ? A Ruby 1.9.2preview1 bug:
# http://redmine.ruby-lang.org/issues/show/1802
# http://redmine.ruby-lang.org/issues/1802
end
end

0 comments on commit 2d59f52

Please sign in to comment.