hwp_script_to_latex 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hwp_script_to_latex/validator.rb +17 -15
- data/lib/hwp_script_to_latex/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32a41ac96bd22ccf4b84bb5357393c41a90f019552d632bf517fb439a63e85cc
|
4
|
+
data.tar.gz: 530c735e69215928b64ead1b51435612542b5e314ae604a7a0d52b7b50c930d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28b7d4bca5aa7247e3bd1b2cd0eaada2953866adf704c96364a3bbdcf15dadec5baeb5a427dac847a0a6262fa2a386e46b910cb6c1fb6cdf67b611a2b25fc1c1
|
7
|
+
data.tar.gz: c83282171a475294c75fbd7f54ae5e31732a1bf762eac52611476fb2b010c403cc6a554b66be7e423c8bf4f4f9ef2ec467436bedaa2cc67cc5a9d059b49b16a5
|
@@ -14,10 +14,7 @@ module HwpScriptToLatex
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def validate(script)
|
17
|
-
|
18
|
-
warnings: [],
|
19
|
-
errors: []
|
20
|
-
}
|
17
|
+
errors = []
|
21
18
|
|
22
19
|
# Default Command
|
23
20
|
@default_commands.each do |command|
|
@@ -25,9 +22,10 @@ module HwpScriptToLatex
|
|
25
22
|
|
26
23
|
match_data = script.match(parameter_bracket_regex)
|
27
24
|
if match_data
|
28
|
-
|
25
|
+
errors << {
|
29
26
|
name: :command_parameter_need_bracket,
|
30
|
-
message: "명령어 파라미터에 중괄호가 누락되었습니다."
|
27
|
+
message: "명령어 파라미터에 중괄호가 누락되었습니다.",
|
28
|
+
detail: script
|
31
29
|
}
|
32
30
|
end
|
33
31
|
end
|
@@ -36,9 +34,10 @@ module HwpScriptToLatex
|
|
36
34
|
parameter_bracket_regex = %r(((?<!\s|})\s*(?i:over|atop))|((?i:over|atop)\s*(?!\s|{)))
|
37
35
|
match_data = script.match(parameter_bracket_regex)
|
38
36
|
if match_data
|
39
|
-
|
37
|
+
errors << {
|
40
38
|
name: :fraction_command_parameter_need_bracket,
|
41
|
-
message: "분수 명령어 파라미터에 중괄호가 누락되었습니다."
|
39
|
+
message: "분수 명령어 파라미터에 중괄호가 누락되었습니다.",
|
40
|
+
detail: script
|
42
41
|
}
|
43
42
|
end
|
44
43
|
|
@@ -46,9 +45,10 @@ module HwpScriptToLatex
|
|
46
45
|
parameter_bracket_regex = %r(((?i:sqrt|root)\s*([^\s{]+))|((?i:sqrt|root)\s*([^\s]+)\s*of\s*([^\s{])))
|
47
46
|
match_data = script.match(parameter_bracket_regex)
|
48
47
|
if match_data
|
49
|
-
|
48
|
+
errors << {
|
50
49
|
name: :sqrt_command_parameter_need_bracket,
|
51
|
-
message: "루트 명령어 파라미터에 중괄호가 누락되었습니다."
|
50
|
+
message: "루트 명령어 파라미터에 중괄호가 누락되었습니다.",
|
51
|
+
detail: script
|
52
52
|
}
|
53
53
|
end
|
54
54
|
|
@@ -60,9 +60,10 @@ module HwpScriptToLatex
|
|
60
60
|
close_bracket_count = script.scan(close_bracket_regex).length
|
61
61
|
|
62
62
|
if open_bracket_count != close_bracket_count
|
63
|
-
|
63
|
+
errors << {
|
64
64
|
name: :invalid_bracket_pair,
|
65
|
-
message: "중괄호 개수가 맞지 않습니다."
|
65
|
+
message: "중괄호 개수가 맞지 않습니다.",
|
66
|
+
detail: script
|
66
67
|
}
|
67
68
|
end
|
68
69
|
|
@@ -72,13 +73,14 @@ module HwpScriptToLatex
|
|
72
73
|
close_parentheses_count = script.scan(close_parentheses_regex).length
|
73
74
|
|
74
75
|
if open_parentheses_count != close_parentheses_count
|
75
|
-
|
76
|
+
errors << {
|
76
77
|
name: :invalid_parentheses_pair,
|
77
|
-
message: "소괄호 개수가 맞지 않습니다."
|
78
|
+
message: "소괄호 개수가 맞지 않습니다.",
|
79
|
+
detail: script
|
78
80
|
}
|
79
81
|
end
|
80
82
|
|
81
|
-
return
|
83
|
+
return errors
|
82
84
|
end
|
83
85
|
end
|
84
86
|
end
|