mathjax-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ ## 1.1a (18 July 2011)
2
+ - Project set up.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :gemcutter
2
+
3
+ # Specify your gem's dependencies in mathjax-rails.gemspec
4
+ gemspec
5
+ # Rails is already being pulled in through gemspec
6
+ # gem "rails", :git => "git://github.com/rails/rails.git"
7
+ gem "sprockets", :git => "git://github.com/sstephenson/sprockets.git"
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2011 Minqi Pan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # MathJax-Rails
2
+
3
+ We are living in an age, where displaying math on web pages is never hard, thanks to the great work of [MathJax](https://github.com/mathjax/MathJax).
4
+
5
+ To quote the description from its official website,
6
+
7
+ > [MathJax](https://github.com/mathjax/MathJax) is an open source JavaScript display engine for mathematics that works in all modern browsers.
8
+ >
9
+ > No more setup for readers. No more browser plugins. No more font installations… It just works.
10
+
11
+ ## Why bother another gem?
12
+
13
+ Integrating MathJax into a rails project however could be a pain. MathJax is HUGE. It makes your project folder swollen very much, because of the excessive amount of files contained in this package. Including mathjax inside your developing directory makes your TextMate less responsive, because when TextMate loses focus and then regains focus, it will scan the whole directory structure for change.
14
+
15
+ Another problem is, where to put? Put into `public` does not seem the best practice, since beginning with rails 3.1 `public` is by default ignored in production environment. Plus it is big, when using git, it leaves you no choice but to throw mathjax inside .gitignore, which makes sharing across developers less painless, and you then get no control over what version of mathjax that other developers use.
16
+
17
+ ## So?
18
+
19
+ That's the time when mathjax-rails comes into play!
20
+
21
+ * It maintains MathJax at a system-wide directory.
22
+ * By simply including mathjax-rails in your Gemfile, all your rails app can benefit from MathJax immediately.
23
+ * You now are in control of the MathJax version by controlling the viersion of mathjax-rails, which is simplely done via Gemfile.
24
+
25
+ ## Usage
26
+
27
+ comming soon...
28
+
29
+ ## Which MathJax version does it use?
30
+
31
+ The version of mathjax-rails reflects the version of MathJax that it contains. They are the same!
32
+
33
+ ## Will it pollute my rails project?
34
+
35
+ No. mathjax-rails do very few things.
data/lib/.DS_Store ADDED
Binary file
@@ -0,0 +1 @@
1
+ require 'mathjax/rails'
@@ -0,0 +1,4 @@
1
+ require 'mathjax/rails/helpers'
2
+ require 'mathjax/rails/routes'
3
+ require 'mathjax/rails/controllers'
4
+ require 'mathjax/rails/version'
@@ -0,0 +1,7 @@
1
+ class MathjaxRailsController < ActionController::Base
2
+ def giveOutStaticFile
3
+ ext = ''
4
+ ext = ".#{params[:format]}" if params[:format]
5
+ send_file(File.expand_path("/../../../vendor/#{Mathjax::Rails::ZIPNAME}/#{params[:uri]+ext}",__FILE__),:disposition=>'inline'))
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module Mathjax
2
+ module Rails
3
+ module ViewHelpers
4
+ def mathjax_tag(configfile='TeX-AMS_HTML-full')
5
+ "<script src=\"#{mathjax_path(:uri=>'MathJax.js')}?config=#{configfile}.js\" type=\"text/javascript\"></script>".html_safe
6
+ end
7
+ end
8
+ end
9
+ end
10
+ ActionView::Base.send :include, Mathjax::Rails::ViewHelpers
@@ -0,0 +1,10 @@
1
+ module Mathjax
2
+ module Rails
3
+ module RouterMethods
4
+ def mathjax(str)
5
+ match "#{str}/*uri" => "MathjaxRails#giveOutStaticFile",:as=>'mathjax'
6
+ end
7
+ end
8
+ end
9
+ end
10
+ ActionDispatch::Routing::Mapper.send :include,Mathjax::Rails::RouterMethods
@@ -0,0 +1,7 @@
1
+ module Mathjax
2
+ module Rails
3
+ VERSION = '0.0.1'
4
+ ZIPNAME = 'mathjax-MathJax-v1.1a-0-g1697387'
5
+ DIRNAME = 'mathjax-MathJax-f5cd294'
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/mathjax/rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "mathjax-rails"
6
+ s.version = Mathjax::Rails::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Minqi Pan"]
9
+ s.email = ["pmq2001@gmail.com"]
10
+ s.homepage = "https://github.com/pmq20/mathjax-rails"
11
+ s.summary = "a simple gem to integrate MathJax with Rails 3"
12
+ s.description = "This gem maintains MathJax at a system-wide directory."
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ #s.rubyforge_project = "mathjax-rails"
16
+
17
+ s.add_dependency "railties", "~> 3.0"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
21
+ s.require_path = 'lib'
22
+
23
+ s.extensions = "unzip.rb"
24
+ end
data/unzip.rb ADDED
@@ -0,0 +1,6 @@
1
+ require File.expand_path('../lib/mathjax/rails/version', __FILE__)
2
+ path = File.expand_path('../vendor',__FILE__)
3
+ print "Unzipping MathJax #{Mathjax::Rails::ZIPNAME}..."
4
+ print "\n"
5
+ print `unzip -q #{path}/#{Mathjax::Rails::ZIPNAME}.zip -d #{path}`
6
+ print "\n"
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mathjax-rails
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Minqi Pan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-18 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: railties
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: "3.0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: This gem maintains MathJax at a system-wide directory.
27
+ email:
28
+ - pmq2001@gmail.com
29
+ executables: []
30
+
31
+ extensions:
32
+ - unzip.rb
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - .DS_Store
37
+ - CHANGELOG.md
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - lib/.DS_Store
42
+ - lib/mathjax-rails.rb
43
+ - lib/mathjax/rails.rb
44
+ - lib/mathjax/rails/controllers.rb
45
+ - lib/mathjax/rails/helpers.rb
46
+ - lib/mathjax/rails/routes.rb
47
+ - lib/mathjax/rails/version.rb
48
+ - mathjax-rails.gemspec
49
+ - unzip.rb
50
+ - vendor/mathjax-MathJax-v1.1a-0-g1697387.zip
51
+ homepage: https://github.com/pmq20/mathjax-rails
52
+ licenses: []
53
+
54
+ post_install_message:
55
+ rdoc_options: []
56
+
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.3.6
71
+ requirements: []
72
+
73
+ rubyforge_project:
74
+ rubygems_version: 1.8.5
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: a simple gem to integrate MathJax with Rails 3
78
+ test_files: []
79
+