Pathname Objects
Web#files_path and Web#blatex_pngs_path now return Pathname objects.
Based on JHerdman's
5d1e8f420b
but requires several other changes to the code (which assumed a string).
Also, test for itex2MML 1.3.10 (you should update that too).
This commit is contained in:
parent
c05d69bcff
commit
336e57d6b4
|
@ -26,7 +26,7 @@ class FileController < ApplicationController
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# no form supplied, this is a request to download the file
|
# no form supplied, this is a request to download the file
|
||||||
file = @web.files_path + '/' + @file_name
|
file = @web.files_path.join(@file_name)
|
||||||
if File.exists?(file)
|
if File.exists?(file)
|
||||||
send_file(file)
|
send_file(file)
|
||||||
else
|
else
|
||||||
|
@ -38,7 +38,7 @@ class FileController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def blahtex_png
|
def blahtex_png
|
||||||
send_file(@web.blahtex_pngs_path + '/' + params['id'])
|
send_file(@web.blahtex_pngs_path.join(params['id']))
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
|
|
|
@ -128,21 +128,18 @@ class Web < ActiveRecord::Base
|
||||||
"#{File.expand_path(dir)} and add files to it."
|
"#{File.expand_path(dir)} and add files to it."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def files_path
|
def files_path
|
||||||
|
path = Rails.root.join("webs")
|
||||||
if default_web?
|
if default_web?
|
||||||
"#{RAILS_ROOT}/webs/files"
|
path.join("files")
|
||||||
else
|
else
|
||||||
"#{RAILS_ROOT}/webs/#{self.address}/files"
|
path.join(address, "files")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def blahtex_pngs_path
|
def blahtex_pngs_path
|
||||||
if default_web?
|
files_path.join("pngs")
|
||||||
"#{RAILS_ROOT}/webs/files/pngs"
|
|
||||||
else
|
|
||||||
"#{RAILS_ROOT}/webs/#{self.address}/files/pngs"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -46,7 +46,7 @@ class WikiFile < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_path
|
def content_path
|
||||||
web.files_path + '/' + file_name
|
web.files_path.join(file_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_content_to_file
|
def write_content_to_file
|
||||||
|
|
|
@ -211,6 +211,13 @@ END_THM
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_have_latest_itex2mml
|
def test_have_latest_itex2mml
|
||||||
|
assert_markup_parsed_as(
|
||||||
|
%{<p>equation <math class='maruku-mathml' displa} +
|
||||||
|
%{y='inline' xmlns='http://www.w3.org/1998/Math/} +
|
||||||
|
%{MathML'><munder><mi>A</mi><mo>\314\262</mo></m} +
|
||||||
|
%{under></math></p>},
|
||||||
|
"equation $\\underline{A}$")
|
||||||
|
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
%{<p>equation <math class='maruku-mathml' } +
|
%{<p>equation <math class='maruku-mathml' } +
|
||||||
%{display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>} +
|
%{display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>} +
|
||||||
|
@ -220,13 +227,13 @@ END_THM
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
%{<p>blackboard digits: <math class='maruku-mathml' display='} +
|
%{<p>blackboard digits: <math class='maruku-mathml' display='} +
|
||||||
%{inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>math} +
|
%{inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>math} +
|
||||||
%{bb</mi><mn>123 </mn></math></p>},
|
%{bb</mi><mn>123</mn></math></p>},
|
||||||
"blackboard digits: $\mathbb{123}$")
|
"blackboard digits: $\mathbb{123}$")
|
||||||
|
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
%{<p>\\rlap: <math class='maruku-mathml' display='} +
|
%{<p>\\rlap: <math class='maruku-mathml' display='} +
|
||||||
%{inline' xmlns='http://www.w3.org/1998/Math/MathML'><mpadded} +
|
%{inline' xmlns='http://www.w3.org/1998/Math/MathML'><mpadded} +
|
||||||
%{ width='0'><mn>123 </mn></mpadded></math></p>},
|
%{ width='0'><mn>123</mn></mpadded></math></p>},
|
||||||
'\rlap: $\rlap{123}$')
|
'\rlap: $\rlap{123}$')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue