Skip to content
This repository has been archived by the owner on Apr 19, 2019. It is now read-only.

Commit

Permalink
Remove TeX
Browse files Browse the repository at this point in the history
As discussed with @vmg
MathJax is available via a flag for those self hosting gollum
  • Loading branch information
bootstraponline committed Oct 19, 2012
1 parent 69ce0eb commit 7c35711
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 83 deletions.
8 changes: 3 additions & 5 deletions gollum.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 1.8.7"

s.name = 'gollum'
s.version = '2.2.9'
s.date = '2012-10-14'
s.version = '2.3.0'
s.date = '2012-10-18'
s.rubyforge_project = 'gollum'

s.summary = "A simple, Git-powered wiki."
Expand All @@ -27,7 +27,6 @@ Gem::Specification.new do |s|
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
s.add_dependency('github-markdown', '~> 0.5.1')
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('mustache', ['>= 0.99.4', '< 1.0.0'])
s.add_dependency('sanitize', '~> 2.0.3')
Expand Down Expand Up @@ -458,7 +457,6 @@ Gem::Specification.new do |s|
lib/gollum/page.rb
lib/gollum/pagination.rb
lib/gollum/sanitization.rb
lib/gollum/tex.rb
lib/gollum/web_sequence_diagram.rb
lib/gollum/wiki.rb
licenses/css_tree_menu_thecssninja/license.txt
Expand All @@ -470,4 +468,4 @@ Gem::Specification.new do |s|
# = MANIFEST =

s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
end
end
3 changes: 1 addition & 2 deletions lib/gollum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
require File.expand_path('../gollum/file_view', __FILE__)
require File.expand_path('../gollum/markup', __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/frontend/uri_encode_component', __FILE__)

module Gollum
VERSION = '2.2.9'
VERSION = '2.3.0'

def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
Expand Down
44 changes: 0 additions & 44 deletions lib/gollum/markup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def initialize(page)
@dir = ::File.dirname(page.path)
@tagmap = {}
@codemap = {}
@texmap = {}
@wsdmap = {}
@premap = {}
@toc = nil
Expand All @@ -57,7 +56,6 @@ def render(no_follow = false, encoding = nil)
data = extract_metadata(data)
data = extract_gitcode(data)
data = extract_code(data)
data = extract_tex(data)
data = extract_wsd(data)
data = extract_tags(data)
begin
Expand All @@ -79,7 +77,6 @@ def render(no_follow = false, encoding = nil)
data = doc.to_xhtml

data = process_toc_tags(data)
data = process_tex(data)
data = process_wsd(data)
data.gsub!(/<p><\/p>/) do
''
Expand Down Expand Up @@ -126,47 +123,6 @@ def process_headers(doc)
[doc, toc]
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
Expand Down
14 changes: 0 additions & 14 deletions lib/gollum/tex.rb

This file was deleted.

18 changes: 0 additions & 18 deletions test/test_markup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -758,24 +758,6 @@ def assert_markup_highlights_code(markup_class, rendered)
]
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
#########################################################################
Expand Down

0 comments on commit 7c35711

Please sign in to comment.