plurimath 0.4.4 → 0.5.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
  SHA256:
3
- metadata.gz: d4c3f2e8fb24ec72671101a001b6a359f1bf678a19b229f7238c7e250bb2689b
4
- data.tar.gz: 1899fb80d23b9145c6a9b61d4fec13d521b3abadf57f81201101ad32b166b816
3
+ metadata.gz: 6fabed12e1b85fa2c5d7b2cacfebaf2bafb8481025f6f0a9b072649ff2991131
4
+ data.tar.gz: ec912de1e4e356af0d7458c0b2147ea9aee1fb4676506429ac5e4161cd974c79
5
5
  SHA512:
6
- metadata.gz: 57dd9fc70c73e8e29209dce21f08dcc4ab16473cf155cf29f19560bfabb0680ca22c4e337b0d766057c6357e24aae1f55a1965f79c881ead796d69730b153337
7
- data.tar.gz: c16720307e808c0e7efe6435302b622aab66ec7dcc2a4df95a898d6b637a834464fd500e33362398033ed1422b3059db63e8577e267a68fbfb09007738af0623
6
+ metadata.gz: d31d2f5b644402ab58c0f19a9c14e88f91fff26d44dff6c89484b66d45d3760087be0827002c87c3b9ca540ac7dd52ad2ceb014f4b0f6b16fc9f94630f823c70
7
+ data.tar.gz: 8f5ea828f70451af6ae075d8e06db4055145e096c83fc39b9a31cdcc57ddfff57afdd736e9f696d83e68d7b6c50ada74fa68f46acc00e878e08c1db22050ed2d
@@ -57,6 +57,7 @@ module Plurimath
57
57
  r_tag,
58
58
  Array(parameter_one.font_style_t_tag(display_style)),
59
59
  )
60
+ [r_tag]
60
61
  end
61
62
  end
62
63
  end
@@ -55,7 +55,7 @@ module Plurimath
55
55
  html_value&.gsub!(PARSER_REGEX) do |_text|
56
56
  last_match = Regexp.last_match
57
57
  case lang
58
- when "mathml", "html"
58
+ when "mathml", "html", "omml"
59
59
  symbol_value(last_match[:unicode])
60
60
  else
61
61
  last_match[:unicode]
@@ -11,6 +11,22 @@ module Plurimath
11
11
  mr
12
12
  r
13
13
  ].freeze
14
+ SUPPORTED_FONTS = {
15
+ "sans-serif-bi": "sans-serif-bold-italic",
16
+ "double-struck": "double-struck",
17
+ "sans-serif-i": "sans-serif-italic",
18
+ "sans-serif-b": "bold-sans-serif",
19
+ "sans-serif-p": "sans-serif",
20
+ "fraktur-p": "fraktur",
21
+ "fraktur-b": "bold-fraktur",
22
+ "script-b": "bold-script",
23
+ "script-p": "script",
24
+ monospace: "monospace",
25
+ bi: "bold-italic",
26
+ p: "normal",
27
+ i: "italic",
28
+ b: "bold",
29
+ }.freeze
14
30
 
15
31
  def initialize(text)
16
32
  @text = text
@@ -72,7 +72,7 @@ module Plurimath
72
72
  font = flatten_row.shift
73
73
  font.new(
74
74
  Utility.filter_values(flatten_row),
75
- Utility::OMML_FONTS.invert[font].to_s,
75
+ Utility::FONT_STYLES.key(font).to_s,
76
76
  )
77
77
  else
78
78
  Utility.filter_values(flatten_row)
@@ -116,7 +116,7 @@ module Plurimath
116
116
  font = flatten_mtd.shift
117
117
  font.new(
118
118
  Utility.filter_values(flatten_mtd),
119
- Utility::OMML_FONTS.invert[font].to_s,
119
+ Utility::FONT_STYLES.rassoc(font).first.to_s,
120
120
  )
121
121
  else
122
122
  flatten_mtd
@@ -133,7 +133,11 @@ module Plurimath
133
133
 
134
134
  rule(rPr: subtree(:rpr)) do
135
135
  if rpr.is_a?(Array)
136
- Utility::OMML_FONTS[rpr.join("-").to_sym]
136
+ Utility::FONT_STYLES[
137
+ Omml::Parser::SUPPORTED_FONTS[
138
+ rpr&.join("-")&.to_sym,
139
+ ]&.to_sym,
140
+ ]
137
141
  end
138
142
  end
139
143
 
@@ -4,24 +4,30 @@ module Plurimath
4
4
  class Utility
5
5
  FONT_STYLES = {
6
6
  "double-struck": Math::Function::FontStyle::DoubleStruck,
7
+ "sans-serif-bold-italic": Math::Function::FontStyle::SansSerifBoldItalic,
8
+ "sans-serif-italic": Math::Function::FontStyle::SansSerifItalic,
9
+ "bold-sans-serif": Math::Function::FontStyle::BoldSansSerif,
7
10
  "sans-serif": Math::Function::FontStyle::SansSerif,
11
+ "bold-fraktur": Math::Function::FontStyle::BoldFraktur,
12
+ "bold-italic": Math::Function::FontStyle::BoldItalic,
13
+ "bold-script": Math::Function::FontStyle::BoldScript,
8
14
  monospace: Math::Function::FontStyle::Monospace,
9
- fraktur: Math::Function::FontStyle::Fraktur,
10
- script: Math::Function::FontStyle::Script,
11
- normal: Math::Function::FontStyle::Normal,
12
- bold: Math::Function::FontStyle::Bold,
13
15
  mathfrak: Math::Function::FontStyle::Fraktur,
14
16
  mathcal: Math::Function::FontStyle::Script,
17
+ fraktur: Math::Function::FontStyle::Fraktur,
15
18
  mathbb: Math::Function::FontStyle::DoubleStruck,
16
19
  mathtt: Math::Function::FontStyle::Monospace,
17
20
  mathsf: Math::Function::FontStyle::SansSerif,
18
21
  mathrm: Math::Function::FontStyle::Normal,
19
22
  textrm: Math::Function::FontStyle::Normal,
23
+ italic: Math::Function::FontStyle::Italic,
20
24
  mathbf: Math::Function::FontStyle::Bold,
21
25
  textbf: Math::Function::FontStyle::Bold,
26
+ script: Math::Function::FontStyle::Script,
27
+ normal: Math::Function::FontStyle::Normal,
28
+ bold: Math::Function::FontStyle::Bold,
22
29
  bbb: Math::Function::FontStyle::DoubleStruck,
23
30
  cal: Math::Function::FontStyle::Script,
24
- bf: Math::Function::FontStyle::Bold,
25
31
  sf: Math::Function::FontStyle::SansSerif,
26
32
  tt: Math::Function::FontStyle::Monospace,
27
33
  fr: Math::Function::FontStyle::Fraktur,
@@ -29,6 +35,7 @@ module Plurimath
29
35
  cc: Math::Function::FontStyle::Script,
30
36
  ii: Math::Function::FontStyle::Italic,
31
37
  bb: Math::Function::FontStyle::Bold,
38
+ bf: Math::Function::FontStyle::Bold,
32
39
  }.freeze
33
40
  ALIGNMENT_LETTERS = {
34
41
  c: "center",
@@ -72,22 +79,6 @@ module Plurimath
72
79
  max
73
80
  min
74
81
  ].freeze
75
- OMML_FONTS = {
76
- "sans-serif-bi": Math::Function::FontStyle::SansSerifBoldItalic,
77
- "sans-serif-i": Math::Function::FontStyle::SansSerifItalic,
78
- "sans-serif-b": Math::Function::FontStyle::BoldSansSerif,
79
- "double-struck": Math::Function::FontStyle::DoubleStruck,
80
- "sans-serif-p": Math::Function::FontStyle::SansSerif,
81
- "fraktur-p": Math::Function::FontStyle::Fraktur,
82
- "fraktur-b": Math::Function::FontStyle::BoldFraktur,
83
- "script-b": Math::Function::FontStyle::BoldScript,
84
- "script-p": Math::Function::FontStyle::Script,
85
- monospace: Math::Function::FontStyle::Monospace,
86
- bi: Math::Function::FontStyle::BoldItalic,
87
- p: Math::Function::FontStyle::Normal,
88
- i: Math::Function::FontStyle::Italic,
89
- b: Math::Function::FontStyle::Bold,
90
- }.freeze
91
82
  PARENTHESIS = {
92
83
  "〈": "〉",
93
84
  "⌊": "⌋",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plurimath
4
- VERSION = "0.4.4"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plurimath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-01 00:00:00.000000000 Z
11
+ date: 2023-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet