mathjax-rails 0.0.4 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +2 -5
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +1 -0
- data/lib/mathjax/rails.rb +2 -1
- data/lib/mathjax/rails/controllers.rb +7 -2
- data/lib/mathjax/rails/mime_types.rb +3 -0
- data/lib/mathjax/rails/routes.rb +1 -1
- data/lib/mathjax/rails/version.rb +1 -1
- data/mathjax-rails.gemspec +3 -3
- metadata +38 -42
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0501bb61bc82d489c95ed5516200449ef7b77e5b
|
4
|
+
data.tar.gz: ba71479a27529ea5ae05e28deb8413ff183b0091
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 39f8d08ab68a576a93057a2662110d47c7610534490b26b52ca710cb574d3f1364bf76393ced946538cc0ea47e51b5cb00b34e39cc1f1a44b4673f6327045dc8
|
7
|
+
data.tar.gz: f6bd6bea51955376a0670c5b4f14610a7a422a7716f30d50f83cd58eff4f53be0bf30022cadab0df088c384e70811a3e3995a98c35abdfdb0b71e2720f24efbc
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in
|
3
|
+
# Specify your gem's dependencies in mathjax_rails.gemspec
|
4
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.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Manu S Ajith
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -38,16 +38,44 @@ then
|
|
38
38
|
|
39
39
|
$ bundle install
|
40
40
|
|
41
|
+
## The other gem
|
42
|
+
|
43
|
+
The new gem is more recently mentained.Thank you Manu S Ajith.
|
44
|
+
|
45
|
+
[](http://badge.fury.io/rb/mathjax-rails)
|
46
|
+
# MathjaxRails
|
47
|
+
|
48
|
+
A Ruby gem for including mathjax for Rails 3.x or above apps
|
49
|
+
|
50
|
+
## Installation
|
51
|
+
|
52
|
+
Add this line to your application's Gemfile:
|
53
|
+
|
54
|
+
gem 'mathjax-rails'
|
55
|
+
|
56
|
+
And then execute:
|
57
|
+
|
58
|
+
$ bundle
|
59
|
+
|
60
|
+
Or install it yourself as:
|
61
|
+
|
62
|
+
$ gem install mathjax-rails
|
63
|
+
|
64
|
+
## Usage
|
65
|
+
|
66
|
+
|
41
67
|
add the following to config/routes.rb (you can change the name of course)
|
42
68
|
|
43
69
|
``` ruby
|
44
70
|
mathjax 'mathjax'
|
45
71
|
```
|
72
|
+
|
46
73
|
add the script tag inside app/views/layouts/application.html.erb
|
47
74
|
|
48
75
|
``` rhtml
|
49
76
|
<%= mathjax_tag %>
|
50
77
|
```
|
78
|
+
|
51
79
|
and it is done!
|
52
80
|
|
53
81
|
To try it, write a simple formula, for example,
|
@@ -96,7 +124,30 @@ If you have a fast CDN service at hand, you don't need this gem.
|
|
96
124
|
|
97
125
|
Putting your MathJax at CDN is probably the best choice.
|
98
126
|
|
127
|
+
By `dmarczal`,
|
128
|
+
|
129
|
+
To work in rails 3.1 on production environment wih ngnix I just comment the follow line in production.rb
|
130
|
+
|
131
|
+
```
|
132
|
+
#config/environments/production.rb
|
133
|
+
#config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
134
|
+
```
|
135
|
+
|
136
|
+
|
137
|
+
|
99
138
|
## ChangeLog
|
100
139
|
|
140
|
+
* 2013.11.21
|
141
|
+
Added support for Rails 4 apps.
|
142
|
+
|
101
143
|
* 2011.7.28
|
102
144
|
Version 0.0.2 used to fail on Heroku. Now the problem is fixed. I used to use `send_file` without content_type, which causes a failure when deployed to Heroku. Now in version 0.0.3 I use `render :type=>...,` with the appropriate content-type set and the problem is solved.
|
145
|
+
|
146
|
+
|
147
|
+
## Contributing
|
148
|
+
|
149
|
+
1. Fork it
|
150
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
151
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
152
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
153
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/mathjax/rails.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class MathjaxRailsController < ActionController::Base
|
1
|
+
class Mathjax::Rails::MathjaxRailsController < ActionController::Base
|
2
2
|
def giveOutStaticFile
|
3
3
|
ext = ''
|
4
4
|
ext = ".#{params[:format]}" if params[:format]
|
@@ -10,6 +10,11 @@ class MathjaxRailsController < ActionController::Base
|
|
10
10
|
options = Hash.new
|
11
11
|
options[:type] = mime_type.to_s unless mime_type.nil?
|
12
12
|
options[:disposition] = 'inline'
|
13
|
-
|
13
|
+
file = File.expand_path(filepath, __FILE__)
|
14
|
+
if File.exists?(file)
|
15
|
+
send_file file, options
|
16
|
+
else
|
17
|
+
render status: 404
|
18
|
+
end
|
14
19
|
end
|
15
20
|
end
|
data/lib/mathjax/rails/routes.rb
CHANGED
@@ -2,7 +2,7 @@ module Mathjax
|
|
2
2
|
module Rails
|
3
3
|
module RouterMethods
|
4
4
|
def mathjax(str)
|
5
|
-
match "#{str}/*uri" => "
|
5
|
+
match "#{str}/*uri" => "mathjax/rails/mathjax_rails#giveOutStaticFile",:as=>'mathjax', via: [:get, :post]
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
data/mathjax-rails.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = "mathjax-rails"
|
6
6
|
s.version = Mathjax::Rails::VERSION
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
|
-
s.authors = ["Minqi Pan"]
|
9
|
-
s.email = ["pmq2001@gmail.com"]
|
8
|
+
s.authors = ["Minqi Pan", "Manu S Ajith"]
|
9
|
+
s.email = ["pmq2001@gmail.com", "neo@codingarena.in"]
|
10
10
|
s.homepage = "https://github.com/pmq20/mathjax-rails"
|
11
11
|
s.summary = "a simple gem to integrate MathJax with Rails 3"
|
12
12
|
s.description = "This gem maintains MathJax at a system-wide directory."
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.required_rubygems_version = ">= 1.3.6"
|
15
15
|
#s.rubyforge_project = "mathjax-rails"
|
16
16
|
|
17
|
-
s.add_dependency "railties", "
|
17
|
+
s.add_dependency "railties", ">= 3.0"
|
18
18
|
|
19
19
|
s.files = `git ls-files`.split("\n")
|
20
20
|
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
|
metadata
CHANGED
@@ -1,49 +1,50 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mathjax-rails
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- Minqi Pan
|
8
|
+
- Manu S Ajith
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: railties
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "3.0"
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.0'
|
24
21
|
type: :runtime
|
25
|
-
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.0'
|
26
28
|
description: This gem maintains MathJax at a system-wide directory.
|
27
|
-
email:
|
29
|
+
email:
|
28
30
|
- pmq2001@gmail.com
|
31
|
+
- neo@codingarena.in
|
29
32
|
executables: []
|
30
|
-
|
31
33
|
extensions: []
|
32
|
-
|
33
34
|
extra_rdoc_files: []
|
34
|
-
|
35
|
-
files:
|
36
|
-
- .DS_Store
|
35
|
+
files:
|
37
36
|
- .gitignore
|
38
37
|
- CHANGELOG.md
|
39
38
|
- Gemfile
|
40
39
|
- LICENSE
|
40
|
+
- LICENSE.txt
|
41
41
|
- README.md
|
42
|
-
-
|
42
|
+
- Rakefile
|
43
43
|
- lib/mathjax-rails.rb
|
44
44
|
- lib/mathjax/rails.rb
|
45
45
|
- lib/mathjax/rails/controllers.rb
|
46
46
|
- lib/mathjax/rails/helpers.rb
|
47
|
+
- lib/mathjax/rails/mime_types.rb
|
47
48
|
- lib/mathjax/rails/routes.rb
|
48
49
|
- lib/mathjax/rails/version.rb
|
49
50
|
- mathjax-rails.gemspec
|
@@ -30075,30 +30076,25 @@ files:
|
|
30075
30076
|
- vendor/mathjax-MathJax-da8d488/unpacked/jax/output/NativeMML/jax.js
|
30076
30077
|
homepage: https://github.com/pmq20/mathjax-rails
|
30077
30078
|
licenses: []
|
30078
|
-
|
30079
|
+
metadata: {}
|
30079
30080
|
post_install_message:
|
30080
30081
|
rdoc_options: []
|
30081
|
-
|
30082
|
-
require_paths:
|
30082
|
+
require_paths:
|
30083
30083
|
- lib
|
30084
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
30085
|
-
|
30086
|
-
|
30087
|
-
|
30088
|
-
|
30089
|
-
|
30090
|
-
|
30091
|
-
|
30092
|
-
|
30093
|
-
- - ">="
|
30094
|
-
- !ruby/object:Gem::Version
|
30084
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30085
|
+
requirements:
|
30086
|
+
- - '>='
|
30087
|
+
- !ruby/object:Gem::Version
|
30088
|
+
version: '0'
|
30089
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
30090
|
+
requirements:
|
30091
|
+
- - '>='
|
30092
|
+
- !ruby/object:Gem::Version
|
30095
30093
|
version: 1.3.6
|
30096
30094
|
requirements: []
|
30097
|
-
|
30098
30095
|
rubyforge_project:
|
30099
|
-
rubygems_version:
|
30096
|
+
rubygems_version: 2.0.5
|
30100
30097
|
signing_key:
|
30101
|
-
specification_version:
|
30098
|
+
specification_version: 4
|
30102
30099
|
summary: a simple gem to integrate MathJax with Rails 3
|
30103
30100
|
test_files: []
|
30104
|
-
|