Compare commits

...

15 Commits

Author SHA1 Message Date
bootstraponline 99e74bf00b Release 2.3.1 2012-10-21 17:16:40 -06:00
bootstraponline f48e923f28 Fix release 2012-10-21 17:15:09 -06:00
bootstraponline 5400b4bfdd Support inline and display math.
$$2^2$$

$2^2$

\\(2^2\\)

[2^2]
2012-10-21 17:15:09 -06:00
bootstraponline f68bebe0f6 Update math note 2012-10-21 16:26:35 -06:00
bootstraponline 4c6019b439 Update math note 2012-10-21 16:23:58 -06:00
bootstraponline 66e08a6b17 Release 2.3.0 2012-10-21 16:19:05 -06:00
bootstraponline 7898db70ed Auto load all MathJax extensions
Fix #549
2012-10-21 16:14:04 -06:00
bootstraponline 7c357116ff Remove TeX
As discussed with @vmg
MathJax is available via a flag for those self hosting gollum
2012-10-18 23:36:05 -06:00
bootstraponline 69ce0eb0d0 Update rake 2012-10-17 21:04:20 -06:00
bootstraponline 4db31a297b Update rake
Jekyll uses rake ~> 0.9
2012-10-17 21:03:29 -06:00
bootstraponline e1fca457e4 Restore gemnasium
Gemnasium fixed the missing pygments.rb issue.

https://github.com/laserlemon/gemnasium-parser/commit/c9b3e43c3021967d5c1bb115e7dd1555e01c6444
2012-10-17 20:54:01 -06:00
bootstraponline 7f8485ce80 Improve system requirements language 2012-10-16 22:31:25 -06:00
bootstraponline 290061fd11 Add system requirements to readme 2012-10-16 22:15:26 -06:00
bootstraponline a507836936 Update dependencies 2012-10-16 21:39:22 -06:00
bootstraponline 6524d20a96 Use pygments.rb 0.3.2 2012-10-16 21:36:37 -06:00
9 changed files with 31 additions and 111 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
source "http://rubygems.org" source 'http://rubygems.org'
gemspec gemspec
gem "rake", "~> 0.9.2.2" gem 'rake', '~> 0.9'
+7 -19
View File
@@ -2,6 +2,7 @@ gollum -- A wiki built on top of Git
==================================== ====================================
[![Build Status](https://secure.travis-ci.org/github/gollum.png?branch=master)](http://travis-ci.org/github/gollum) [![Build Status](https://secure.travis-ci.org/github/gollum.png?branch=master)](http://travis-ci.org/github/gollum)
[![Dependency Status](https://gemnasium.com/github/gollum.png)](https://gemnasium.com/github/gollum)
## DESCRIPTION ## DESCRIPTION
@@ -18,6 +19,11 @@ number of ways depending on your needs. You can edit your wiki locally:
Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
[TomDoc](http://tomdoc.org/) for inline documentation. [TomDoc](http://tomdoc.org/) for inline documentation.
## SYSTEM REQUIREMENTS
- Python 2.5+ (2.7.3 recommended)
- Ruby 1.8.7+ (1.9.3 recommended)
- Unix like operating system (OS X, Ubuntu, Debian, and more)
- Will not work on Windows (because of [grit](https://github.com/github/grit))
## INSTALLATION ## INSTALLATION
@@ -357,25 +363,7 @@ appropriately.
## MATHEMATICAL EQUATIONS ## MATHEMATICAL EQUATIONS
Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the autoload-all extension.
Page files may contain mathematic equations in TeX syntax that will be nicely
typeset into the expected output. A block-style equation is delimited by `\[`
and `\]`. For example:
\[ P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
Inline equations are delimited by `\(` and `\)`. These equations will appear
inline with regular text. For example:
The Pythagorean theorem is \( a^2 + b^2 = c^2 \).
### INSTALLATION REQUIREMENTS
In order to get the mathematical equations rendering to work, you need the following binaries:
* LaTex, TeTex or MacTex/BasicTeX (pdflatex)
* Netpbm (pnmcrop, pnmpad, pnmscale, ppmtopgm, pnmgamma, pnmtopng)
* Ghostscript (gs)
## SEQUENCE DIAGRAMS ## SEQUENCE DIAGRAMS
+1
View File
@@ -113,6 +113,7 @@ task :release => :build do
puts "You must be on the master branch to release!" puts "You must be on the master branch to release!"
exit! exit!
end end
sh "git pull"
sh "git commit --allow-empty -a -m 'Release #{version}'" sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git tag v#{version}" sh "git tag v#{version}"
sh "git push origin master" sh "git push origin master"
+9 -11
View File
@@ -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.1'
s.date = '2012-10-14' s.date = '2012-10-21'
s.rubyforge_project = 'gollum' s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki." s.summary = "A simple, Git-powered wiki."
@@ -26,22 +26,21 @@ Gem::Specification.new do |s|
s.add_dependency('grit', '~> 2.5.0') s.add_dependency('grit', '~> 2.5.0')
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.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('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')
s.add_dependency('nokogiri', '~> 1.5.5') s.add_dependency('nokogiri', '~> 1.5.5')
s.add_dependency('useragent', '~> 0.4.10') s.add_dependency('useragent', '~> 0.4.12')
s.add_dependency('stringex', '~> 1.4.0') s.add_dependency('stringex', '~> 1.4.0')
s.add_development_dependency('RedCloth', '~> 4.2.9') s.add_development_dependency('RedCloth', '~> 4.2.9')
s.add_development_dependency('mocha', '~> 0.12.6') s.add_development_dependency('mocha', '~> 0.12.7')
s.add_development_dependency('org-ruby', '~> 0.7.1') s.add_development_dependency('org-ruby', '~> 0.7.2')
s.add_development_dependency('shoulda', '~> 3.1.1') s.add_development_dependency('shoulda', '~> 3.3.1')
s.add_development_dependency('rack-test', '~> 0.6.2') s.add_development_dependency('rack-test', '~> 0.6.2')
s.add_development_dependency('wikicloth', '~> 0.8.0') s.add_development_dependency('wikicloth', '~> 0.8.0')
s.add_development_dependency('rake', '~> 0.9.2.2') s.add_development_dependency('rake', '~> 0.9')
# = MANIFEST = # = MANIFEST =
s.files = %w[ s.files = %w[
@@ -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
View File
@@ -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.1'
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__))
+11 -1
View File
@@ -18,7 +18,17 @@
<script type="text/javascript" src="{{base_url}}/javascript/gollum.dialog.js"></script> <script type="text/javascript" src="{{base_url}}/javascript/gollum.dialog.js"></script>
<script type="text/javascript" src="{{base_url}}/javascript/gollum.placeholder.js"></script> <script type="text/javascript" src="{{base_url}}/javascript/gollum.placeholder.js"></script>
<script type="text/javascript" src="{{base_url}}/javascript/editor/gollum.editor.js"></script> <script type="text/javascript" src="{{base_url}}/javascript/editor/gollum.editor.js"></script>
{{#mathjax}}<script>(function(d,j){ {{#mathjax}}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ['\\(','\\)']],
displayMath: [ ['$$','$$'], ['\[','\]'] ],
processEscapes: true
},
TeX: { extensions: ["autoload-all.js"] }});
</script>
<script>(function(d,j){
j = d.createElement('script'); j = d.createElement('script');
j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
(d.head || d.getElementsByTagName('head')[0]).appendChild(j); (d.head || d.getElementsByTagName('head')[0]).appendChild(j);
-44
View 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
-14
View File
@@ -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
-18
View File
@@ -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
######################################################################### #########################################################################