hwp_script_to_latex 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/hwp_script_to_latex/converter.rb +6 -2
- data/lib/hwp_script_to_latex/version.rb +1 -1
- data/rules.json +46 -10
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: cbec7629446845a9e8a032ac6a18220d8e98ae45b04373226e28fd57f5b223a0
|
|
4
|
+
data.tar.gz: b8dddbb8013737cebda2bf585d6c43fbb4f599cad27e5fb9d173639b866efdd4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 057df5544c8144b21eb84bd9839e1052fcf5531c2ef0d0c47bbc2a9a8af82da095936104002e4527db58291ead2f7803c32aeb73c71259a525d58e378ca28ece
|
|
7
|
+
data.tar.gz: 521410d609cd79bee57b2a12bfc0c0fdfdb35cedceb640c72b955f9b7fd20f12685982b5a3dcb2021861c5d6a4a8b7b4e7c82207860b225f99976384661514f2
|
|
@@ -5,7 +5,7 @@ module HwpScriptToLatex
|
|
|
5
5
|
class Converter
|
|
6
6
|
# 한글 수식스크립트를 LaTeX 문법으로 변환
|
|
7
7
|
|
|
8
|
-
def convert(script, math_mode: false)
|
|
8
|
+
def convert(script, math_mode: false, display_mode: false)
|
|
9
9
|
latex = script
|
|
10
10
|
|
|
11
11
|
# Step 1. 단순치환
|
|
@@ -35,8 +35,12 @@ module HwpScriptToLatex
|
|
|
35
35
|
latex = latex.gsub(frac_regex, ' \frac \1\2 ')
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
if display_mode
|
|
39
|
+
latex = "\\displaystyle{#{latex}}"
|
|
40
|
+
end
|
|
41
|
+
|
|
38
42
|
if math_mode
|
|
39
|
-
|
|
43
|
+
latex = "$#{latex}$"
|
|
40
44
|
end
|
|
41
45
|
|
|
42
46
|
return latex
|
data/rules.json
CHANGED
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
"regex": "&rt;|>",
|
|
12
12
|
"latex": " > "
|
|
13
13
|
},
|
|
14
|
+
{
|
|
15
|
+
"regex": "∾",
|
|
16
|
+
"latex": " \\backsim "
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"regex": "\\\xf3\\\xb0\\\x81\\\x80",
|
|
20
|
+
"latex": " \\backsim "
|
|
21
|
+
},
|
|
14
22
|
|
|
15
23
|
{
|
|
16
24
|
"regex": "box",
|
|
@@ -25,6 +33,16 @@
|
|
|
25
33
|
"regex": "ddot",
|
|
26
34
|
"latex": " \\ddot "
|
|
27
35
|
},
|
|
36
|
+
{
|
|
37
|
+
"regex": "vdots",
|
|
38
|
+
"latex": " \\vdots ",
|
|
39
|
+
"ignorecase": true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"regex": "sum",
|
|
43
|
+
"latex": " \\sum ",
|
|
44
|
+
"ignorecase": true
|
|
45
|
+
},
|
|
28
46
|
{
|
|
29
47
|
"regex": "acute",
|
|
30
48
|
"latex": " \\acute "
|
|
@@ -352,6 +370,10 @@
|
|
|
352
370
|
"regex": "cap",
|
|
353
371
|
"latex": " \\cap "
|
|
354
372
|
},
|
|
373
|
+
{
|
|
374
|
+
"regex": "CAP",
|
|
375
|
+
"latex": " \\cap "
|
|
376
|
+
},
|
|
355
377
|
{
|
|
356
378
|
"regex": "Cap",
|
|
357
379
|
"latex": " \\Cap "
|
|
@@ -370,10 +392,34 @@
|
|
|
370
392
|
"regex": "cup",
|
|
371
393
|
"latex": " \\cup "
|
|
372
394
|
},
|
|
395
|
+
{
|
|
396
|
+
"regex": "CUP",
|
|
397
|
+
"latex": " \\cup "
|
|
398
|
+
},
|
|
373
399
|
{
|
|
374
400
|
"regex": "Cup",
|
|
375
401
|
"latex": " \\Cup "
|
|
376
402
|
},
|
|
403
|
+
{
|
|
404
|
+
"regex": "union",
|
|
405
|
+
"latex": " \\cup ",
|
|
406
|
+
"ignorecase": true
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"regex": "smallunion",
|
|
410
|
+
"latex": " \\cup ",
|
|
411
|
+
"ignorecase": true
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"regex": "inter",
|
|
415
|
+
"latex": " \\cap ",
|
|
416
|
+
"ignorecase": true
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"regex": "smallinter",
|
|
420
|
+
"latex": " \\cap ",
|
|
421
|
+
"ignorecase": true
|
|
422
|
+
},
|
|
377
423
|
{
|
|
378
424
|
"regex": "sqcup",
|
|
379
425
|
"latex": " \\sqcup ",
|
|
@@ -897,16 +943,6 @@
|
|
|
897
943
|
"latex": " \\rangle ",
|
|
898
944
|
"ignorecase": true
|
|
899
945
|
},
|
|
900
|
-
{
|
|
901
|
-
"regex": "left\s*{",
|
|
902
|
-
"latex": " left\\{ ",
|
|
903
|
-
"ignorecase": true
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
"regex": "right\s*}",
|
|
907
|
-
"latex": " right\\} ",
|
|
908
|
-
"ignorecase": true
|
|
909
|
-
},
|
|
910
946
|
{
|
|
911
947
|
"regex": "lfloor",
|
|
912
948
|
"latex": " \\lfloor ",
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hwp_script_to_latex
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- bluesh55
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-04-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
97
97
|
version: '0'
|
|
98
98
|
requirements: []
|
|
99
99
|
rubyforge_project:
|
|
100
|
-
rubygems_version: 2.
|
|
100
|
+
rubygems_version: 2.7.8
|
|
101
101
|
signing_key:
|
|
102
102
|
specification_version: 4
|
|
103
103
|
summary: Convert hwp script to latex
|