latexmath 0.1.5 → 1.0.0
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 +4 -4
- data/CHANGELOG.md +50 -0
- data/LICENSE.md +33 -0
- data/README.adoc +133 -14
- data/artifacts/latex.bindings.python.json +1 -0
- data/artifacts/latex.bindings.rs.json +1 -0
- data/artifacts/latex.bindings.ruby.json +1 -0
- data/artifacts/latex.bindings.ts.json +1 -0
- data/artifacts/latex.checksums.txt +19 -0
- data/artifacts/latex.json +1 -0
- data/data/latex-symbols.json +3301 -0
- data/docs/model-contract.adoc +125 -0
- data/docs/parser-contract.adoc +349 -0
- data/docs/testsuite-pin.adoc +76 -0
- data/grammars/latex.wrappers.json +17 -0
- data/lib/latexmath/model/nodes.rb +918 -0
- data/lib/latexmath/model.rb +44 -0
- data/lib/latexmath/parser/artifact.rb +80 -0
- data/lib/latexmath/parser/configuration.rb +35 -0
- data/lib/latexmath/parser/engine.rb +161 -0
- data/lib/latexmath/parser/errors.rb +51 -0
- data/lib/latexmath/parser/native_recursion_guard.rb +43 -0
- data/lib/latexmath/parser/preprocessor.rb +77 -0
- data/lib/latexmath/parser/raw_parser.rb +84 -0
- data/lib/latexmath/parser/source_map.rb +121 -0
- data/lib/latexmath/parser/unwrap.rb +91 -0
- data/lib/latexmath/parser.rb +97 -0
- data/lib/latexmath/symbols.rb +74 -0
- data/lib/latexmath/version.rb +1 -1
- data/lib/latexmath.rb +5 -87
- data/model/latex.lml.checksums.txt +36 -0
- data/model/latex.lml.json +3350 -0
- metadata +60 -72
- data/.editorconfig +0 -14
- data/.github/workflows/test.yml +0 -80
- data/.gitignore +0 -22
- data/.rspec +0 -3
- data/.rubocop.yml +0 -129
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -10
- data/Gemfile.lock +0 -79
- data/Rakefile +0 -95
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/exe/latexmath +0 -8
- data/latexmath.gemspec +0 -34
- data/lib/latexmath/aggregator.rb +0 -351
- data/lib/latexmath/constants/symbols.rb +0 -3936
- data/lib/latexmath/converter.rb +0 -424
- data/lib/latexmath/equation.rb +0 -13
- data/lib/latexmath/ext.rb +0 -9
- data/lib/latexmath/symbol.rb +0 -21
- data/lib/latexmath/tokenizer.rb +0 -82
- data/lib/latexmath/xml/builder.rb +0 -4
- data/lib/latexmath/xml/element.rb +0 -25
- data/lib/unimathsymbols.js.erb +0 -4
- data/lib/unimathsymbols.txt +0 -2864
- data/opal/latexmath-opal.rb +0 -40
- data/opal/ox.rb +0 -64
- data/opal/pseudoenumerator.rb +0 -19
data/opal/latexmath-opal.rb
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require 'opal'
|
|
2
|
-
require 'corelib/string/unpack'
|
|
3
|
-
require 'pseudoenumerator'
|
|
4
|
-
require 'htmlentities'
|
|
5
|
-
require 'htmlentities/mappings/html4' # Dynamic require
|
|
6
|
-
require 'htmlentities/mappings/xhtml1' # Dynamic require
|
|
7
|
-
require 'htmlentities/mappings/expanded' # Dynamic require
|
|
8
|
-
require 'latexmath'
|
|
9
|
-
|
|
10
|
-
# Override 2 methods that use dynamic execution so we don't need to require a parser
|
|
11
|
-
class HTMLEntities
|
|
12
|
-
class Encoder
|
|
13
|
-
def build_basic_entity_encoder(instructions)
|
|
14
|
-
if instructions.include?(:basic) || instructions.include?(:named)
|
|
15
|
-
method = :encode_named
|
|
16
|
-
elsif instructions.include?(:decimal)
|
|
17
|
-
method = :encode_decimal
|
|
18
|
-
elsif instructions.include?(:hexadecimal)
|
|
19
|
-
method = :encode_hexadecimal
|
|
20
|
-
end
|
|
21
|
-
self.class.define_method :encode_basic do |char|
|
|
22
|
-
send(method, char)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def build_extended_entity_encoder(instructions)
|
|
27
|
-
operations = [:named, :decimal, :hexadecimal] & instructions
|
|
28
|
-
|
|
29
|
-
self.class.define_method :encode_extended do |char|
|
|
30
|
-
|
|
31
|
-
operations.each do |encoder|
|
|
32
|
-
encoded = send(:"encode_#{encoder}", char)
|
|
33
|
-
return encoded if encoded
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
char
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
data/opal/ox.rb
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# A minimal Ox implementation for Opal
|
|
2
|
-
|
|
3
|
-
module Ox
|
|
4
|
-
CODER = HTMLEntities.new
|
|
5
|
-
|
|
6
|
-
class Document
|
|
7
|
-
def initialize
|
|
8
|
-
@root = nil
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def << child
|
|
12
|
-
@root = child
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def dump
|
|
16
|
-
@root.dump
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
class Element
|
|
21
|
-
def initialize tag_name
|
|
22
|
-
@tag_name = tag_name
|
|
23
|
-
@attrs = {}
|
|
24
|
-
@children = []
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def []= key, value
|
|
28
|
-
@attrs[key] = value
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def << child
|
|
32
|
-
@children << child
|
|
33
|
-
self
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def value= value
|
|
37
|
-
@tag_name = value
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def dump
|
|
41
|
-
attrs = @attrs.map do |k,v|
|
|
42
|
-
%Q< #{k}="#{CODER.encode(v)}">
|
|
43
|
-
end.join("")
|
|
44
|
-
"<#{@tag_name}#{attrs}>"+
|
|
45
|
-
@children.map(&:dump).join("")+
|
|
46
|
-
"</#{@tag_name}>"
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
class Raw
|
|
51
|
-
def initialize value
|
|
52
|
-
@value = value
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def dump
|
|
56
|
-
#CODER.encode(@value)
|
|
57
|
-
@value
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def self.dump doc
|
|
62
|
-
doc.dump
|
|
63
|
-
end
|
|
64
|
-
end
|
data/opal/pseudoenumerator.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Opal doesn't support Enumerator's #next and #peek extended methods. This tries
|
|
2
|
-
# to emulate them.
|
|
3
|
-
|
|
4
|
-
class Pseudoenumerator
|
|
5
|
-
def initialize obj
|
|
6
|
-
@obj = obj.to_a.reverse
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def next
|
|
10
|
-
out = peek
|
|
11
|
-
@obj.pop
|
|
12
|
-
out
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def peek
|
|
16
|
-
raise StopIteration if @obj.length == 0
|
|
17
|
-
@obj.last
|
|
18
|
-
end
|
|
19
|
-
end
|