Remove TeX
As discussed with @vmg MathJax is available via a flag for those self hosting gollum
This commit is contained in:
+3
-5
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|||||||
s.required_ruby_version = ">= 1.8.7"
|
s.required_ruby_version = ">= 1.8.7"
|
||||||
|
|
||||||
s.name = 'gollum'
|
s.name = 'gollum'
|
||||||
s.version = '2.2.9'
|
s.version = '2.3.0'
|
||||||
s.date = '2012-10-14'
|
s.date = '2012-10-18'
|
||||||
s.rubyforge_project = 'gollum'
|
s.rubyforge_project = 'gollum'
|
||||||
|
|
||||||
s.summary = "A simple, Git-powered wiki."
|
s.summary = "A simple, Git-powered wiki."
|
||||||
@@ -27,7 +27,6 @@ Gem::Specification.new do |s|
|
|||||||
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
|
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
|
||||||
s.add_dependency('github-markdown', '~> 0.5.1')
|
s.add_dependency('github-markdown', '~> 0.5.1')
|
||||||
s.add_dependency('pygments.rb', '~> 0.3.2')
|
s.add_dependency('pygments.rb', '~> 0.3.2')
|
||||||
s.add_dependency('escape_utils', '0.2.4')
|
|
||||||
s.add_dependency('sinatra', '~> 1.3.3')
|
s.add_dependency('sinatra', '~> 1.3.3')
|
||||||
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
|
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
|
||||||
s.add_dependency('sanitize', '~> 2.0.3')
|
s.add_dependency('sanitize', '~> 2.0.3')
|
||||||
@@ -458,7 +457,6 @@ Gem::Specification.new do |s|
|
|||||||
lib/gollum/page.rb
|
lib/gollum/page.rb
|
||||||
lib/gollum/pagination.rb
|
lib/gollum/pagination.rb
|
||||||
lib/gollum/sanitization.rb
|
lib/gollum/sanitization.rb
|
||||||
lib/gollum/tex.rb
|
|
||||||
lib/gollum/web_sequence_diagram.rb
|
lib/gollum/web_sequence_diagram.rb
|
||||||
lib/gollum/wiki.rb
|
lib/gollum/wiki.rb
|
||||||
licenses/css_tree_menu_thecssninja/license.txt
|
licenses/css_tree_menu_thecssninja/license.txt
|
||||||
@@ -470,4 +468,4 @@ Gem::Specification.new do |s|
|
|||||||
# = MANIFEST =
|
# = MANIFEST =
|
||||||
|
|
||||||
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-2
@@ -18,12 +18,11 @@ require File.expand_path('../gollum/file', __FILE__)
|
|||||||
require File.expand_path('../gollum/file_view', __FILE__)
|
require File.expand_path('../gollum/file_view', __FILE__)
|
||||||
require File.expand_path('../gollum/markup', __FILE__)
|
require File.expand_path('../gollum/markup', __FILE__)
|
||||||
require File.expand_path('../gollum/sanitization', __FILE__)
|
require File.expand_path('../gollum/sanitization', __FILE__)
|
||||||
require File.expand_path('../gollum/tex', __FILE__)
|
|
||||||
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
||||||
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
||||||
|
|
||||||
module Gollum
|
module Gollum
|
||||||
VERSION = '2.2.9'
|
VERSION = '2.3.0'
|
||||||
|
|
||||||
def self.assets_path
|
def self.assets_path
|
||||||
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ module Gollum
|
|||||||
@dir = ::File.dirname(page.path)
|
@dir = ::File.dirname(page.path)
|
||||||
@tagmap = {}
|
@tagmap = {}
|
||||||
@codemap = {}
|
@codemap = {}
|
||||||
@texmap = {}
|
|
||||||
@wsdmap = {}
|
@wsdmap = {}
|
||||||
@premap = {}
|
@premap = {}
|
||||||
@toc = nil
|
@toc = nil
|
||||||
@@ -57,7 +56,6 @@ module Gollum
|
|||||||
data = extract_metadata(data)
|
data = extract_metadata(data)
|
||||||
data = extract_gitcode(data)
|
data = extract_gitcode(data)
|
||||||
data = extract_code(data)
|
data = extract_code(data)
|
||||||
data = extract_tex(data)
|
|
||||||
data = extract_wsd(data)
|
data = extract_wsd(data)
|
||||||
data = extract_tags(data)
|
data = extract_tags(data)
|
||||||
begin
|
begin
|
||||||
@@ -79,7 +77,6 @@ module Gollum
|
|||||||
data = doc.to_xhtml
|
data = doc.to_xhtml
|
||||||
|
|
||||||
data = process_toc_tags(data)
|
data = process_toc_tags(data)
|
||||||
data = process_tex(data)
|
|
||||||
data = process_wsd(data)
|
data = process_wsd(data)
|
||||||
data.gsub!(/<p><\/p>/) do
|
data.gsub!(/<p><\/p>/) do
|
||||||
''
|
''
|
||||||
@@ -126,47 +123,6 @@ module Gollum
|
|||||||
[doc, toc]
|
[doc, toc]
|
||||||
end
|
end
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
#
|
|
||||||
# TeX
|
|
||||||
#
|
|
||||||
#########################################################################
|
|
||||||
|
|
||||||
# Extract all TeX into the texmap and replace with placeholders.
|
|
||||||
#
|
|
||||||
# data - The raw String data.
|
|
||||||
#
|
|
||||||
# Returns the placeholder'd String data.
|
|
||||||
def extract_tex(data)
|
|
||||||
data.gsub(/\\\[\s*(.*?)\s*\\\]/m) do
|
|
||||||
tag = CGI.escapeHTML($1)
|
|
||||||
id = Digest::SHA1.hexdigest(tag)
|
|
||||||
@texmap[id] = [:block, tag]
|
|
||||||
id
|
|
||||||
end.gsub(/\\\(\s*(.*?)\s*\\\)/m) do
|
|
||||||
tag = CGI.escapeHTML($1)
|
|
||||||
id = Digest::SHA1.hexdigest(tag)
|
|
||||||
@texmap[id] = [:inline, tag]
|
|
||||||
id
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Process all TeX from the texmap and replace the placeholders with the
|
|
||||||
# final markup.
|
|
||||||
#
|
|
||||||
# data - The String data (with placeholders).
|
|
||||||
#
|
|
||||||
# Returns the marked up String data.
|
|
||||||
def process_tex(data)
|
|
||||||
@texmap.each do |id, spec|
|
|
||||||
type, tex = *spec
|
|
||||||
data.gsub!(id) do
|
|
||||||
Gollum::Tex.to_html(tex, type)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
data
|
|
||||||
end
|
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Tags
|
# Tags
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
require 'escape_utils'
|
|
||||||
|
|
||||||
module Gollum
|
|
||||||
module Tex
|
|
||||||
TEX_URL = "http://www.mathtran.org/cgi-bin/toy/"
|
|
||||||
TEX_SIZES = { :inline => 2, :block => 4 }
|
|
||||||
|
|
||||||
def self.to_html(tex, type = :inline)
|
|
||||||
tex_uri = EscapeUtils.escape_uri(tex)
|
|
||||||
tex_alt = EscapeUtils.escape_html(tex)
|
|
||||||
%{<img src="#{TEX_URL}?D=#{TEX_SIZES[type]};tex=#{tex_uri}" alt="#{tex_alt}">}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -758,24 +758,6 @@ end
|
|||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
#
|
|
||||||
# TeX
|
|
||||||
#
|
|
||||||
#########################################################################
|
|
||||||
|
|
||||||
test "TeX block syntax" do
|
|
||||||
content = 'a \[ a^2 \] b'
|
|
||||||
output = "<p>a<imgsrc=\"http://www.mathtran.org/cgi-bin/toy/?D=4;tex=a%5E2\"alt=\"a^2\">b</p>"
|
|
||||||
compare(content, output, 'md')
|
|
||||||
end
|
|
||||||
|
|
||||||
test "TeX inline syntax" do
|
|
||||||
content = 'a \( a^2 \) b'
|
|
||||||
output = "<p>a<imgsrc=\"http://www.mathtran.org/cgi-bin/toy/?D=2;tex=a%5E2\"alt=\"a^2\">b</p>"
|
|
||||||
compare(content, output, 'md')
|
|
||||||
end
|
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Asciidoc
|
# Asciidoc
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user