stepmod-utils 0.3.35 → 0.3.37
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce39eaa361d527a10f6fc6f903f4fed05d61f4a9a41cb212b9a1540addc89a0d
|
4
|
+
data.tar.gz: 25191fe5b6fab1f15d1c3fcd3193a38adcf05a69918ab460a3c410eccedcefd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7196d637c4704b34e743680bcfad24232769c2c1919b9795f40e8ea634a0174f1b0b6a6a6dc9673354b717956bc3b65a346d27563abc462563c7b2f35b26eacd
|
7
|
+
data.tar.gz: a0f729d5d7bdebe7d707aa8153de5f9e04fdeb766fdb0e40516136f768a9ce959e76f504721dac1a03cf17efe6ca90ecf6aef3fb78c84742548e2fd5ed8adb64
|
@@ -5,14 +5,39 @@ module Stepmod
|
|
5
5
|
module Converters
|
6
6
|
class Em < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, state = {})
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
italic_converted(node, state)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def italic_converted(node, state)
|
14
|
+
cloned_node = node.clone
|
15
|
+
equations = extract_equations(cloned_node)
|
16
|
+
content = treat_children(cloned_node, state.merge(already_italic: true))
|
17
|
+
equation_content = equations.map do |equation|
|
18
|
+
treat(equation, state.merge(equation: true, already_italic: true))
|
19
|
+
end
|
20
|
+
|
21
|
+
content = if content.strip.empty? || state[:already_italic] || state[:equation]
|
12
22
|
content
|
13
23
|
else
|
14
24
|
"#{content[/^\s*/]}_#{content.strip}_#{content[/\s*$/]}"
|
15
25
|
end
|
26
|
+
|
27
|
+
[content, equation_content].compact.join("")
|
28
|
+
end
|
29
|
+
|
30
|
+
def extract_equations(node)
|
31
|
+
equations = []
|
32
|
+
|
33
|
+
node.children.each do |n|
|
34
|
+
next if n.name != "eqn"
|
35
|
+
|
36
|
+
equations << n
|
37
|
+
n.unlink
|
38
|
+
end
|
39
|
+
|
40
|
+
equations
|
16
41
|
end
|
17
42
|
end
|
18
43
|
|
@@ -50,8 +50,7 @@ module Stepmod
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def stem_converted(cloned_node, state)
|
53
|
-
|
54
|
-
# remove_tags_not_in_context(cloned_node)
|
53
|
+
remove_tags_not_in_context(cloned_node)
|
55
54
|
internal_content = treat_children(cloned_node, state.merge(equation: true))
|
56
55
|
content = Stepmod::Utils::HtmlToAsciimath.new.call(internal_content)
|
57
56
|
res = <<~TEMPLATE
|
@@ -20,9 +20,7 @@ module Stepmod
|
|
20
20
|
treat(equation, state.merge(equation: true, already_strong: true))
|
21
21
|
end
|
22
22
|
|
23
|
-
content = if state[:equation]
|
24
|
-
"bb(#{content.strip})"
|
25
|
-
elsif content.strip.empty? || state[:already_strong]
|
23
|
+
content = if content.strip.empty? || state[:already_strong] || state[:equation]
|
26
24
|
content
|
27
25
|
else
|
28
26
|
strong_tag = state[:non_flanking_whitesapce] ? '**' : '*'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepmod-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.37
|
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-11-
|
11
|
+
date: 2023-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|