asciidoctor-mathematical 0.3.2 → 0.3.3

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: faf0fb4e29f2614d868f99bd0d85367a0a6db8ca6481668b2061ad452abf097f
4
- data.tar.gz: a05239f948741cd7474442e095dbc0cb920da2d60bec09ec21965ae36f236a0e
3
+ metadata.gz: e817ca8a177571fe61d368e26b09d8b35e1560b38ac8f971e14281f403b88344
4
+ data.tar.gz: 96d5d392cdf0ff18fd2d4bb3972247230f2c00b552b345ef42202f3327eede11
5
5
  SHA512:
6
- metadata.gz: 0de6aa46ffbf1450dee13b0710c00445839a767a8ca238d0ed9643163da84b19a995c776221b5698508f832bcbfbd94d7da297563db3a7cdebb2a6b99c3705c5
7
- data.tar.gz: 37bc274bfa70f1d653ae01ad25195c528b2a55758db519bc1677e872c6d42204bcda86db281f2ffb914ca7901d44452a3c1debe6b4c1008fb26eee366479b92c
6
+ metadata.gz: 0a50106271975fa4975ff5511f969106e088de7e0a94d4fd64b65eff1c29d97c1131bdad2547732a90ca30555dd28c5fc2b31a2e74fc86b460764ace24dde8a1
7
+ data.tar.gz: ec3da1e35a5d0ab1ef4ff6005b0aa81802e477400b87078564b0a9d32e85e92a6a1c288b02c048ef1a17ddd44e002e00030ff8ef4f7a304915200258068ea4e7
@@ -151,28 +151,39 @@ class MathematicalTreeprocessor < Asciidoctor::Extensions::Treeprocessor
151
151
  end
152
152
 
153
153
  source_modified = false
154
+
154
155
  # TODO skip passthroughs in the source (e.g., +stem:[x^2]+)
155
- text = text.gsub(stem_rx) {
156
- if (m = $~)[0].start_with? '\\'
157
- next m[0][1..-1]
158
- end
156
+ if text != nil && text.include? ':'
157
+ text = text.gsub(stem_rx) {
158
+ if (m = $~)[0].start_with? '\\'
159
+ next m[0][1..-1]
160
+ end
159
161
 
160
- if (eq_data = m[2].rstrip).empty?
161
- next
162
- else
163
- source_modified = true
164
- end
162
+ if (eq_data = m[2].rstrip).empty?
163
+ next
164
+ else
165
+ source_modified = true
166
+ end
165
167
 
166
- eq_data.gsub! '\]', ']'
167
- subs = m[1].nil_or_empty? ? (to_html ? [:specialcharacters] : []) : (node.resolve_pass_subs m[1])
168
- eq_data = node.apply_subs eq_data, subs unless subs.empty?
169
- img_target, img_width, img_height = make_equ_image eq_data, nil, true, mathematical, image_output_dir, image_target_dir, format, inline
170
- if inline
171
- %(pass:[<span class="steminline"> #{img_target} </span>])
172
- else
173
- %(image:#{img_target}[width=#{img_width},height=#{img_height}])
174
- end
175
- } if (text != nil) && (text.include? ':') && ((support_stem_prefix && (text.include? 'stem:')) || (text.include? 'latexmath:') || (text.include? 'asciimath:'))
168
+ if text.include? 'asciimath:'
169
+ eq_data = AsciiMath.parse(eq_data).to_latex
170
+ else if (support_stem_prefix && (text.include? 'stem:')) || (text.include? 'latexmath:')
171
+ eq_data.gsub! '\]', ']'
172
+ subs = m[1].nil_or_empty? ? (to_html ? [:specialcharacters] : []) : (node.resolve_pass_subs m[1])
173
+ eq_data = node.apply_subs eq_data, subs unless subs.empty?
174
+ else
175
+ source_modified = false
176
+ return text
177
+ end
178
+
179
+ img_target, img_width, img_height = make_equ_image eq_data, nil, true, mathematical, image_output_dir, image_target_dir, format, inline
180
+ if inline
181
+ %(pass:[<span class="steminline"> #{img_target} </span>])
182
+ else
183
+ %(image:#{img_target}[width=#{img_width},height=#{img_height}])
184
+ end
185
+ }
186
+ end
176
187
 
177
188
  [text, source_modified]
178
189
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-mathematical
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Stumm
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubygems_version: 3.1.3
130
+ rubygems_version: 3.1.4
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Asciidoctor STEM processor based on Mathematical