asciidoctor-mathjax3 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dafc77e7505b12f79c70457f6db99a785a243fcdbd39653507868cd075b236d3
4
+ data.tar.gz: 5d668fde081de04d7feb534dbbf4316a57c572b262df83caa36f9c1653bca2c2
5
+ SHA512:
6
+ metadata.gz: 49f7f7c5e7a8e4fdb6463c6adf1eb6b0a9548a70b32a4f3fda171e80b0c6df03aea4e8bab30d49750c5ca9ab09c62824a3f43a312b4eb4943e50a5ea5d9b3476
7
+ data.tar.gz: d1b87a6008234974c758b539fea08bbd326dd5b34c90c07910d1c8156431ffb8d8ffea6d30099845fd7bbe5f0ce20fba78753125453dc866fedee05e57aac3d4
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # User
14
+ Gemfile.lock
15
+ /vendor/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in asciidoctor-mathjax3.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 TANIGUCHI Masaya
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,41 @@
1
+ # Asciidoctor MathJax3
2
+
3
+ This project provides an Asciidoctor plugin for converting block and inline STEM in TeX notation (latexmath) to HTML using MathJax3 library.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'asciidoctor-mathjax3'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install asciidoctor-mathjax3
20
+
21
+ ## Usage
22
+
23
+ If you invoke Asciidoctor from command-line, use option `-r` to load the extension:
24
+
25
+ ```
26
+ asciidoctor -r asciidoctor-mathjax3 <filename>.adoc
27
+ ```
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tani/asciidoctor-mathjax3.
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,24 @@
1
+ require_relative 'lib/asciidoctor/mathjax3/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "asciidoctor-mathjax3"
5
+ spec.version = Asciidoctor::MathJax3::VERSION
6
+ spec.authors = ["TANIGUCHI Masaya"]
7
+ spec.email = ["ta2gch@gmail.com"]
8
+
9
+ spec.summary = %q{Asciidoctor Plugin that converts latexmath using Mathjax 3}
10
+ spec.homepage = "https://github.com/tani/asciidoctor-mathjax3"
11
+ spec.license = "MIT"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = spec.homepage
16
+ spec.metadata["changelog_uri"] = spec.homepage
17
+
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency "asciidoctor", ">= 1.5.7", "< 2.0.0"
24
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "asciidoctor/mathjax3"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1 @@
1
+ require 'asciidoctor/mathjax3'
@@ -0,0 +1,12 @@
1
+ require 'asciidoctor' unless RUBY_PLATFORM == 'opal'
2
+ require 'asciidoctor/extensions' unless RUBY_PLATFORM == 'opal'
3
+ require 'asciidoctor/mathjax3/postprocessor'
4
+ require 'asciidoctor/mathjax3/version'
5
+
6
+ unless RUBY_PLATFORM == 'opal'
7
+ Asciidoctor::Extensions.register do
8
+ if (@document.basebackend? 'html')
9
+ postprocessor Asciidoctor::MathJax3::Postprocessor
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ require 'asciidoctor' unless RUBY_PLATFORM == 'opal'
2
+ require 'asciidoctor/extensions' unless RUBY_PLATFORM == 'opal'
3
+
4
+ module Asciidoctor::MathJax3
5
+ class Postprocessor < Asciidoctor::Extensions::Postprocessor
6
+ def process document, output
7
+ cfg = %r{<script type="text/x-mathjax-config">.*?</script>}m
8
+ m2 = %r{<script src=".*?TeX-MML-AM_HTMLorMML"></script>}
9
+ m3 = %(<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>)
10
+ output.sub(cfg, '').sub(m2, m3)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Asciidoctor
2
+ module MathJax3
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asciidoctor-mathjax3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - TANIGUCHI Masaya
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: asciidoctor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.7
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.7
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
33
+ description:
34
+ email:
35
+ - ta2gch@gmail.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - ".gitignore"
41
+ - ".rspec"
42
+ - ".travis.yml"
43
+ - Gemfile
44
+ - LICENSE.txt
45
+ - README.md
46
+ - Rakefile
47
+ - asciidoctor-mathjax3.gemspec
48
+ - bin/console
49
+ - bin/setup
50
+ - lib/asciidoctor-mathjax3.rb
51
+ - lib/asciidoctor/mathjax3.rb
52
+ - lib/asciidoctor/mathjax3/postprocessor.rb
53
+ - lib/asciidoctor/mathjax3/version.rb
54
+ homepage: https://github.com/tani/asciidoctor-mathjax3
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ homepage_uri: https://github.com/tani/asciidoctor-mathjax3
59
+ source_code_uri: https://github.com/tani/asciidoctor-mathjax3
60
+ changelog_uri: https://github.com/tani/asciidoctor-mathjax3
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 2.3.0
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubygems_version: 3.1.2
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Asciidoctor Plugin that converts latexmath using Mathjax 3
80
+ test_files: []