Fix BlahTeX/PNG Path

Dunno why Ari tolerated this
up till now.
This commit is contained in:
Jacques Distler 2010-01-25 17:55:31 -06:00
parent d3db9d1229
commit 9dc59b7b7c
4 changed files with 16 additions and 4 deletions

View file

@ -90,7 +90,7 @@ module Engines
:html_math_output_png => true, :html_math_output_png => true,
:html_png_engine => 'blahtex', :html_png_engine => 'blahtex',
:html_png_dir => @content.web.files_path.join('pngs').to_s, :html_png_dir => @content.web.files_path.join('pngs').to_s,
:html_png_url => '../files/pngs/', :html_png_url => @content.options[:png_url],
:content_only => true, :content_only => true,
:author => @content.options[:engine_opts][:author], :author => @content.options[:engine_opts][:author],
:title => @content.options[:engine_opts][:title]}) :title => @content.options[:engine_opts][:title]})
@ -104,7 +104,7 @@ module Engines
:html_math_output_png => true, :html_math_output_png => true,
:html_png_engine => 'blahtex', :html_png_engine => 'blahtex',
:html_png_dir => @content.web.files_path.join('pngs').to_s, :html_png_dir => @content.web.files_path.join('pngs').to_s,
:html_png_url => '../files/pngs/'}).to_html :html_png_url => @content.options[:png_url]}).to_html
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

View file

@ -7,6 +7,8 @@ class AbstractUrlGenerator
@controller = controller @controller = controller
end end
attr :controller
# Create a link for the given page (or file) name and link text based # Create a link for the given page (or file) name and link text based
# on the render mode in options and whether the page (file) exists # on the render mode in options and whether the page (file) exists
# in the web. # in the web.

View file

@ -143,6 +143,12 @@ class WikiContent < String
@options[:active_chunks] = (ACTIVE_CHUNKS - [WikiChunk::Word] ) if @web.brackets_only? @options[:active_chunks] = (ACTIVE_CHUNKS - [WikiChunk::Word] ) if @web.brackets_only?
@options[:hide_chunks] = (HIDE_CHUNKS - [Literal::Math] ) unless @options[:hide_chunks] = (HIDE_CHUNKS - [Literal::Math] ) unless
[Engines::MarkdownMML, Engines::MarkdownPNG].include?(@options[:engine]) [Engines::MarkdownMML, Engines::MarkdownPNG].include?(@options[:engine])
if @options[:engine] == Engines::MarkdownPNG
@options[:png_url] =
@options[:mode] == :export ? 'files/pngs/' :
(@url_generator.controller.url_for :controller => 'file', :web => @web.address,
:action => 'file', :id => 'pngs', :only_path => true) + '/'
end
@not_rendered = @pre_rendered = nil @not_rendered = @pre_rendered = nil

View file

@ -104,9 +104,13 @@ end
class StubUrlGenerator < AbstractUrlGenerator class StubUrlGenerator < AbstractUrlGenerator
def initialize def initialize
super(:doesnt_need_controller) controller = Object.new
def controller.url_for(options = {})
'../files/pngs'
end
super(controller)
end end
def file_link(mode, name, text, web_name, known_file, description) def file_link(mode, name, text, web_name, known_file, description)
link = CGI.escape(name) link = CGI.escape(name)
case mode case mode