asciimath 1.0.0.preview.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79e61b8558a971dd887b6e48246a1ee34be6098e
4
- data.tar.gz: c7f13147dbb2460cf4ab5564249a0391fdb57095
3
+ metadata.gz: db33412e95fb41f457c468d34b93d85384ebf114
4
+ data.tar.gz: 6b62bc0d4745fa50df1dc6329c40d819933be1fd
5
5
  SHA512:
6
- metadata.gz: 6c7a2f710248ecf71df6a124aecf8e96e0e626b7448831166212572a24cccf615ef85c2f3749531499e3dc2155122c5b219dba012a6cc264de668532ab869962
7
- data.tar.gz: 8350a5355cdf93da68d7c9224c8cc820a2fd01b2edee38cd758f6911c75e577f63d5a216b9e2d114c308bb8bd07af95ea1d717b55fd097afedb7b565de8284a4
6
+ metadata.gz: d8e3fa85489e4d609c90945c161086bc10c7ead9156ce4d10073cae0ff8b994515ec2b736f4dbe2aa6cb0cde2a5e5bd38ebeb6f3a0240104dca1a1fedec78eab
7
+ data.tar.gz: 44543b4567c6d9eb2572f0254dd3a36f6dad1dacfde9b0fe2bc7ce8dea99e106ea7aa8a59508731353b68d89746ff0c0711c33d1ea743ac814b32a077be1adc9
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Asciimath
1
+ # AsciiMath
2
2
 
3
- An [asciimath](http://asciimath.org) parser and MathML generator written in pure Ruby.
3
+ An [AsciiMath](http://asciimath.org) parser and MathML generator written in pure Ruby.
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,11 +20,43 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ ### Library
24
+
25
+ First require the library.
26
+
27
+ ```
28
+ require 'asciimath'
29
+ ```
30
+
31
+ Then parse an AsciiMath string.
32
+
33
+ ```
34
+ parsed_expression = AsciiMath.parse(asciimath)
35
+ ```
36
+
37
+ The parsed expression is a set of nested Array and Hash objects.
38
+
39
+ This expression can then be converted to MathML.
40
+
41
+ ```
42
+ math_ml = parsed_expression.to_mathml
43
+ ```
44
+
45
+ The MathML code is returned as a String.
46
+
47
+ ### Command line
48
+
49
+ The AsciiMath parser and MathML converter can be invoked via the command line as follows:
50
+
51
+ ```
52
+ asciimath "an asciimath string"
53
+ ```
54
+
55
+ This command will print out the generated MathML code on stdout.
24
56
 
25
57
  ## Contributing
26
58
 
27
- 1. Fork it ( https://github.com/[my-github-username]/asciimath/fork )
59
+ 1. Fork it ( https://github.com/pepijnve/asciimath/fork )
28
60
  2. Create your feature branch (`git checkout -b my-new-feature`)
29
61
  3. Commit your changes (`git commit -am 'Add some feature'`)
30
62
  4. Push to the branch (`git push origin my-new-feature`)
@@ -5,11 +5,11 @@ require 'asciimath/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "asciimath"
8
- spec.version = Asciimath::VERSION
8
+ spec.version = AsciiMath::VERSION
9
9
  spec.authors = ["Pepijn Van Eeckhoudt"]
10
10
  spec.email = ["pepijn@vaneeckhoudt.net"]
11
- spec.summary = %q{Asciimath parser and converter}
12
- spec.description = %q{A pure Ruby Asciimath parsing and conversion library.}
11
+ spec.summary = %q{AsciiMath parser and converter}
12
+ spec.description = %q{A pure Ruby AsciiMath parsing and conversion library.}
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'asciimath/cli'
4
- ::Asciimath::CLI.run(ARGV)
4
+ ::AsciiMath::CLI.run(ARGV)
@@ -1,11 +1,11 @@
1
1
  require_relative 'parser'
2
2
  require_relative 'mathml'
3
3
 
4
- module Asciimath
4
+ module AsciiMath
5
5
  module CLI
6
6
  def self.run(args)
7
7
  asciimath = args.last
8
- mathml = Asciimath.parse(asciimath).to_mathml
8
+ mathml = AsciiMath.parse(asciimath).to_mathml
9
9
  puts mathml
10
10
  end
11
11
  end
@@ -1,4 +1,4 @@
1
- module Asciimath
1
+ module AsciiMath
2
2
  class MathMLBuilder
3
3
  def initialize(prefix)
4
4
  @prefix = prefix
@@ -26,7 +26,7 @@ require 'strscan'
26
26
  # When parsing the 'constant' the parser will try to find the longest matching string in the symbol
27
27
  # table starting at the current position of the parser. If no matching string can be found the
28
28
  # character at the current position of the parser is interpreted as an identifier instead.
29
- module Asciimath
29
+ module AsciiMath
30
30
  # Internal: Splits an ASCIIMath expression into a sequence of tokens.
31
31
  # Each token is represented as a Hash containing the keys :value and :type.
32
32
  # The :value key is used to store the text associated with each token.
@@ -1,3 +1,3 @@
1
- module Asciimath
2
- VERSION = "1.0.0.preview.1"
1
+ module AsciiMath
2
+ VERSION = "1.0.0"
3
3
  end
@@ -44,17 +44,17 @@ TEST_CASES = {
44
44
  '<math><munderover><mo>&#x2211;</mo><mrow><mi>k</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></munderover><mi>k</mi><mo>=</mo><mn>1</mn><mo>+</mo><mn>2</mn><mo>+</mo><mo>&#x22EF;</mo><mo>+</mo><mi>n</mi><mo>=</mo><mfrac><mrow><mi>n</mi><mrow><mo>(</mo><mi>n</mi><mo>+</mo><mn>1</mn><mo>)</mo></mrow></mrow><mn>2</mn></mfrac></math>',
45
45
  }
46
46
 
47
- module AsciimathHelper
47
+ module AsciiMathHelper
48
48
  def expect_mathml(asciimath, mathml)
49
- expect(Asciimath.parse(asciimath).to_mathml).to eq(mathml)
49
+ expect(AsciiMath.parse(asciimath).to_mathml).to eq(mathml)
50
50
  end
51
51
  end
52
52
 
53
53
  RSpec.configure do |c|
54
- c.include AsciimathHelper
54
+ c.include AsciiMathHelper
55
55
  end
56
56
 
57
- describe "Asciimath::MathMLBuilder" do
57
+ describe "AsciiMath::MathMLBuilder" do
58
58
  TEST_CASES.each_pair do |asciimath, mathml|
59
59
  it "should produce identical output to asciimathml.js for '#{asciimath}'" do
60
60
  expect_mathml(asciimath, mathml)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciimath
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.preview.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pepijn Van Eeckhoudt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 2015-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.1.0
55
- description: A pure Ruby Asciimath parsing and conversion library.
55
+ description: A pure Ruby AsciiMath parsing and conversion library.
56
56
  email:
57
57
  - pepijn@vaneeckhoudt.net
58
58
  executables:
@@ -88,14 +88,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ">"
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
- version: 1.3.1
93
+ version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.2.2
96
+ rubygems_version: 2.4.7
97
97
  signing_key:
98
98
  specification_version: 4
99
- summary: Asciimath parser and converter
99
+ summary: AsciiMath parser and converter
100
100
  test_files:
101
101
  - test/parser_spec.rb
102
+ has_rdoc: