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 +4 -4
- data/lib/asciidoctor-mathematical/extension.rb +30 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e817ca8a177571fe61d368e26b09d8b35e1560b38ac8f971e14281f403b88344
|
4
|
+
data.tar.gz: 96d5d392cdf0ff18fd2d4bb3972247230f2c00b552b345ef42202f3327eede11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
156
|
-
|
157
|
-
|
158
|
-
|
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
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
162
|
+
if (eq_data = m[2].rstrip).empty?
|
163
|
+
next
|
164
|
+
else
|
165
|
+
source_modified = true
|
166
|
+
end
|
165
167
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
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.
|
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.
|
130
|
+
rubygems_version: 3.1.4
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Asciidoctor STEM processor based on Mathematical
|