d-mark 1.0.0b2 → 1.0.0b3
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 +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +152 -54
- data/NEWS.md +10 -0
- data/README.md +3 -5
- data/d-mark.gemspec +2 -1
- data/ddenv.yaml +3 -0
- data/lib/d-mark/parser.rb +9 -5
- data/lib/d-mark/translator.rb +2 -1
- data/lib/d-mark/version.rb +1 -1
- data/spec/d-mark/element_node_spec.rb +14 -9
- data/spec/d-mark/parser_spec.rb +10 -4
- data/spec/d-mark/translator_spec.rb +9 -5
- data/spec/spec_helper.rb +0 -7
- metadata +10 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b41f64c853bc4220552bf0d050aea2194786a51d682ca3c64a0ffa3d941e31f4
|
|
4
|
+
data.tar.gz: 9ab2309f47041fccd48bb1487f10e04a62cca86a8f2b5745805edf08bb584584
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d3394cf204fff4e738737eb5cc6acf059e216469ca4fbabfa17c728cc0aff88fda7137c27e4b2c7ca7a6d434e6b7c0adb2caf5dea9501015bc46173eac0e471
|
|
7
|
+
data.tar.gz: 778c81bca44884846af47f83d7902ba0b7a8681d6965325d36e653399564c438cd13a955ddd685f90975ce156e6a46c0574b08775b66abf877cf8a2dbadb81a2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,100 +1,198 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
d-mark (1.0.
|
|
4
|
+
d-mark (1.0.0b3)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
ast (2.4.
|
|
10
|
-
codecov (0.2.12)
|
|
11
|
-
json
|
|
12
|
-
simplecov
|
|
9
|
+
ast (2.4.3)
|
|
13
10
|
coderay (1.1.3)
|
|
14
|
-
diff-lcs (1.
|
|
15
|
-
|
|
16
|
-
ffi (1.
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
diff-lcs (1.6.2)
|
|
12
|
+
ffi (1.17.2)
|
|
13
|
+
ffi (1.17.2-aarch64-linux-gnu)
|
|
14
|
+
ffi (1.17.2-aarch64-linux-musl)
|
|
15
|
+
ffi (1.17.2-arm-linux-gnu)
|
|
16
|
+
ffi (1.17.2-arm-linux-musl)
|
|
17
|
+
ffi (1.17.2-arm64-darwin)
|
|
18
|
+
ffi (1.17.2-x86-linux-gnu)
|
|
19
|
+
ffi (1.17.2-x86-linux-musl)
|
|
20
|
+
ffi (1.17.2-x86_64-darwin)
|
|
21
|
+
ffi (1.17.2-x86_64-linux-gnu)
|
|
22
|
+
ffi (1.17.2-x86_64-linux-musl)
|
|
23
|
+
formatador (1.2.3)
|
|
24
|
+
reline
|
|
25
|
+
guard (2.19.1)
|
|
19
26
|
formatador (>= 0.2.4)
|
|
20
27
|
listen (>= 2.7, < 4.0)
|
|
28
|
+
logger (~> 1.6)
|
|
21
29
|
lumberjack (>= 1.0.12, < 2.0)
|
|
22
30
|
nenv (~> 0.1)
|
|
23
31
|
notiffany (~> 0.0)
|
|
24
|
-
|
|
32
|
+
ostruct (~> 0.6)
|
|
33
|
+
pry (>= 0.13.0)
|
|
25
34
|
shellany (~> 0.0)
|
|
26
35
|
thor (>= 0.18.1)
|
|
27
36
|
guard-rake (1.0.0)
|
|
28
37
|
guard
|
|
29
38
|
rake
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
io-console (0.8.1)
|
|
40
|
+
json (2.16.0)
|
|
41
|
+
language_server-protocol (3.17.0.5)
|
|
42
|
+
lint_roller (1.1.0)
|
|
43
|
+
listen (3.9.0)
|
|
32
44
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
33
45
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
logger (1.7.0)
|
|
47
|
+
lumberjack (1.4.2)
|
|
48
|
+
method_source (1.1.0)
|
|
36
49
|
nenv (0.3.0)
|
|
37
50
|
notiffany (0.1.3)
|
|
38
51
|
nenv (~> 0.1)
|
|
39
52
|
shellany (~> 0.0)
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
ostruct (0.6.3)
|
|
54
|
+
parallel (1.27.0)
|
|
55
|
+
parser (3.3.10.0)
|
|
42
56
|
ast (~> 2.4.1)
|
|
43
|
-
|
|
57
|
+
racc
|
|
58
|
+
prism (1.6.0)
|
|
59
|
+
pry (0.15.2)
|
|
44
60
|
coderay (~> 1.1)
|
|
45
61
|
method_source (~> 1.0)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
rb-
|
|
62
|
+
racc (1.8.1)
|
|
63
|
+
rainbow (3.1.1)
|
|
64
|
+
rake (13.3.1)
|
|
65
|
+
rb-fsevent (0.11.2)
|
|
66
|
+
rb-inotify (0.11.1)
|
|
50
67
|
ffi (~> 1.0)
|
|
51
|
-
regexp_parser (2.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
rspec-
|
|
56
|
-
rspec-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
68
|
+
regexp_parser (2.11.3)
|
|
69
|
+
reline (0.6.3)
|
|
70
|
+
io-console (~> 0.5)
|
|
71
|
+
rspec (3.13.2)
|
|
72
|
+
rspec-core (~> 3.13.0)
|
|
73
|
+
rspec-expectations (~> 3.13.0)
|
|
74
|
+
rspec-mocks (~> 3.13.0)
|
|
75
|
+
rspec-core (3.13.6)
|
|
76
|
+
rspec-support (~> 3.13.0)
|
|
77
|
+
rspec-expectations (3.13.5)
|
|
60
78
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
61
|
-
rspec-support (~> 3.
|
|
62
|
-
rspec-mocks (3.
|
|
79
|
+
rspec-support (~> 3.13.0)
|
|
80
|
+
rspec-mocks (3.13.7)
|
|
63
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
64
|
-
rspec-support (~> 3.
|
|
65
|
-
rspec-support (3.
|
|
66
|
-
rubocop (1.7
|
|
82
|
+
rspec-support (~> 3.13.0)
|
|
83
|
+
rspec-support (3.13.6)
|
|
84
|
+
rubocop (1.81.7)
|
|
85
|
+
json (~> 2.3)
|
|
86
|
+
language_server-protocol (~> 3.17.0.2)
|
|
87
|
+
lint_roller (~> 1.1.0)
|
|
67
88
|
parallel (~> 1.10)
|
|
68
|
-
parser (>=
|
|
89
|
+
parser (>= 3.3.0.2)
|
|
69
90
|
rainbow (>= 2.2.2, < 4.0)
|
|
70
|
-
regexp_parser (>=
|
|
71
|
-
|
|
72
|
-
rubocop-ast (>= 1.2.0, < 2.0)
|
|
91
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
92
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
73
93
|
ruby-progressbar (~> 1.7)
|
|
74
|
-
unicode-display_width (>=
|
|
75
|
-
rubocop-ast (1.
|
|
76
|
-
parser (>=
|
|
77
|
-
|
|
94
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
95
|
+
rubocop-ast (1.48.0)
|
|
96
|
+
parser (>= 3.3.7.2)
|
|
97
|
+
prism (~> 1.4)
|
|
98
|
+
rubocop-capybara (2.22.1)
|
|
99
|
+
lint_roller (~> 1.1)
|
|
100
|
+
rubocop (~> 1.72, >= 1.72.1)
|
|
101
|
+
rubocop-factory_bot (2.28.0)
|
|
102
|
+
lint_roller (~> 1.1)
|
|
103
|
+
rubocop (~> 1.72, >= 1.72.1)
|
|
104
|
+
rubocop-rspec (2.31.0)
|
|
105
|
+
rubocop (~> 1.40)
|
|
106
|
+
rubocop-capybara (~> 2.17)
|
|
107
|
+
rubocop-factory_bot (~> 2.22)
|
|
108
|
+
rubocop-rspec_rails (~> 2.28)
|
|
109
|
+
rubocop-rspec_rails (2.29.1)
|
|
110
|
+
rubocop (~> 1.61)
|
|
111
|
+
ruby-progressbar (1.13.0)
|
|
78
112
|
shellany (0.0.1)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
simplecov-html (0.12.3)
|
|
84
|
-
simplecov_json_formatter (0.1.2)
|
|
85
|
-
thor (1.0.1)
|
|
86
|
-
unicode-display_width (1.7.0)
|
|
113
|
+
thor (1.4.0)
|
|
114
|
+
unicode-display_width (3.2.0)
|
|
115
|
+
unicode-emoji (~> 4.1)
|
|
116
|
+
unicode-emoji (4.1.0)
|
|
87
117
|
|
|
88
118
|
PLATFORMS
|
|
119
|
+
aarch64-linux-gnu
|
|
120
|
+
aarch64-linux-musl
|
|
121
|
+
arm-linux-gnu
|
|
122
|
+
arm-linux-musl
|
|
123
|
+
arm64-darwin
|
|
89
124
|
ruby
|
|
125
|
+
x86-linux-gnu
|
|
126
|
+
x86-linux-musl
|
|
127
|
+
x86_64-darwin
|
|
128
|
+
x86_64-linux-gnu
|
|
129
|
+
x86_64-linux-musl
|
|
90
130
|
|
|
91
131
|
DEPENDENCIES
|
|
92
|
-
codecov
|
|
93
132
|
d-mark!
|
|
94
133
|
guard
|
|
95
134
|
guard-rake
|
|
96
135
|
rspec
|
|
97
136
|
rubocop
|
|
137
|
+
rubocop-rspec (~> 2.1)
|
|
138
|
+
|
|
139
|
+
CHECKSUMS
|
|
140
|
+
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
141
|
+
coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
|
|
142
|
+
d-mark (1.0.0b3)
|
|
143
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
144
|
+
ffi (1.17.2) sha256=297235842e5947cc3036ebe64077584bff583cd7a4e94e9a02fdec399ef46da6
|
|
145
|
+
ffi (1.17.2-aarch64-linux-gnu) sha256=c910bd3cae70b76690418cce4572b7f6c208d271f323d692a067d59116211a1a
|
|
146
|
+
ffi (1.17.2-aarch64-linux-musl) sha256=69e6556b091d45df83e6c3b19d3c54177c206910965155a6ec98de5e893c7b7c
|
|
147
|
+
ffi (1.17.2-arm-linux-gnu) sha256=d4a438f2b40224ae42ec72f293b3ebe0ba2159f7d1bd47f8417e6af2f68dbaa5
|
|
148
|
+
ffi (1.17.2-arm-linux-musl) sha256=977dfb7f3a6381206dbda9bc441d9e1f9366bf189a634559c3b7c182c497aaa3
|
|
149
|
+
ffi (1.17.2-arm64-darwin) sha256=54dd9789be1d30157782b8de42d8f887a3c3c345293b57ffb6b45b4d1165f813
|
|
150
|
+
ffi (1.17.2-x86-linux-gnu) sha256=95d8f9ebea23c39888e2ab85a02c98f54acb2f4e79b829250d7267ce741dc7b0
|
|
151
|
+
ffi (1.17.2-x86-linux-musl) sha256=41741449bab2b9530f42a47baa5c26263925306fad0ac2d60887f51af2e3b24c
|
|
152
|
+
ffi (1.17.2-x86_64-darwin) sha256=981f2d4e32ea03712beb26e55e972797c2c5a7b0257955d8667ba58f2da6440e
|
|
153
|
+
ffi (1.17.2-x86_64-linux-gnu) sha256=05d2026fc9dbb7cfd21a5934559f16293815b7ce0314846fee2ac8efbdb823ea
|
|
154
|
+
ffi (1.17.2-x86_64-linux-musl) sha256=97c0eb3981414309285a64dc4d466bd149e981c279a56371ef811395d68cb95c
|
|
155
|
+
formatador (1.2.3) sha256=19fa898133c2c26cdbb5d09f6998c1e137ad9427a046663e55adfe18b950d894
|
|
156
|
+
guard (2.19.1) sha256=b8bc52694be3d8b26730280de7dcec7fe92ea1cff3414246fe96af3f23580f3d
|
|
157
|
+
guard-rake (1.0.0) sha256=5d7e388bdbf0f83b3e0d6bdaa3c4009c53a4e4062c0cb1d83eafad39fd9ccccd
|
|
158
|
+
io-console (0.8.1) sha256=1e15440a6b2f67b6ea496df7c474ed62c860ad11237f29b3bd187f054b925fcb
|
|
159
|
+
json (2.16.0) sha256=ca5630320bb5ca23ebfd0bac84532fab56eb357575653b815b9df42c051e1525
|
|
160
|
+
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
161
|
+
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
162
|
+
listen (3.9.0) sha256=db9e4424e0e5834480385197c139cb6b0ae0ef28cc13310cfd1ca78377d59c67
|
|
163
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
164
|
+
lumberjack (1.4.2) sha256=40de5ae46321380c835031bcc1370f13bba304d29f2b5f5bb152061a5a191b95
|
|
165
|
+
method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
|
|
166
|
+
nenv (0.3.0) sha256=d9de6d8fb7072228463bf61843159419c969edb34b3cef51832b516ae7972765
|
|
167
|
+
notiffany (0.1.3) sha256=d37669605b7f8dcb04e004e6373e2a780b98c776f8eb503ac9578557d7808738
|
|
168
|
+
ostruct (0.6.3) sha256=95a2ed4a4bd1d190784e666b47b2d3f078e4a9efda2fccf18f84ddc6538ed912
|
|
169
|
+
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
|
|
170
|
+
parser (3.3.10.0) sha256=ce3587fa5cc55a88c4ba5b2b37621b3329aadf5728f9eafa36bbd121462aabd6
|
|
171
|
+
prism (1.6.0) sha256=bfc0281a81718c4872346bc858dc84abd3a60cae78336c65ad35c8fbff641c6b
|
|
172
|
+
pry (0.15.2) sha256=12d54b8640d3fa29c9211dd4ffb08f3fd8bf7a4fd9b5a73ce5b59c8709385b6b
|
|
173
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
174
|
+
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
175
|
+
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
|
|
176
|
+
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
|
|
177
|
+
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
|
|
178
|
+
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
|
|
179
|
+
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
|
|
180
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
181
|
+
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
|
|
182
|
+
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
183
|
+
rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
|
|
184
|
+
rspec-support (3.13.6) sha256=2e8de3702427eab064c9352fe74488cc12a1bfae887ad8b91cba480ec9f8afb2
|
|
185
|
+
rubocop (1.81.7) sha256=6fb5cc298c731691e2a414fe0041a13eb1beed7bab23aec131da1bcc527af094
|
|
186
|
+
rubocop-ast (1.48.0) sha256=22df9bbf3f7a6eccde0fad54e68547ae1e2a704bf8719e7c83813a99c05d2e76
|
|
187
|
+
rubocop-capybara (2.22.1) sha256=ced88caef23efea53f46e098ff352f8fc1068c649606ca75cb74650970f51c0c
|
|
188
|
+
rubocop-factory_bot (2.28.0) sha256=4b17fc02124444173317e131759d195b0d762844a71a29fe8139c1105d92f0cb
|
|
189
|
+
rubocop-rspec (2.31.0) sha256=2bae19388d78e1ceace44cd95fd34f3209f4ef20cac1b168d0a1325cbba3d672
|
|
190
|
+
rubocop-rspec_rails (2.29.1) sha256=4ae95abbe9ca5a9b6d8be14e50d230fb5b6ba033b05d4c0981b5b76fc44988e4
|
|
191
|
+
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
192
|
+
shellany (0.0.1) sha256=0e127a9132698766d7e752e82cdac8250b6adbd09e6c0a7fbbb6f61964fedee7
|
|
193
|
+
thor (1.4.0) sha256=8763e822ccb0f1d7bee88cde131b19a65606657b847cc7b7b4b82e772bcd8a3d
|
|
194
|
+
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
195
|
+
unicode-emoji (4.1.0) sha256=4997d2d5df1ed4252f4830a9b6e86f932e2013fbff2182a9ce9ccabda4f325a5
|
|
98
196
|
|
|
99
197
|
BUNDLED WITH
|
|
100
|
-
|
|
198
|
+
2.7.2
|
data/NEWS.md
CHANGED
data/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# D★Mark
|
|
2
2
|
|
|
3
|
-
[](https://codeclimate.com/github/ddfreyne/d-mark)
|
|
6
|
-
[](https://codecov.io/github/ddfreyne/d-mark)
|
|
3
|
+
[](http://rubygems.org/gems/d-mark)
|
|
4
|
+

|
|
7
5
|
|
|
8
6
|
_D★Mark_ is a language for marking up prose. It facilitates writing semantically meaningful text, without limiting itself to the semantics provided by HTML or Markdown.
|
|
9
7
|
|
|
@@ -17,4 +15,4 @@ Here’s an example of D★Mark:
|
|
|
17
15
|
#note[only=web] This is a note that will %em{only} show up on web.
|
|
18
16
|
```
|
|
19
17
|
|
|
20
|
-
For details, see the [D★Mark web page](http://
|
|
18
|
+
For details, see the [D★Mark web page](http://denisdefreyne.github.io/d-mark/).
|
data/d-mark.gemspec
CHANGED
|
@@ -20,5 +20,6 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
s.rdoc_options = ['--main', 'README.md']
|
|
21
21
|
s.extra_rdoc_files = ['LICENSE', 'README.md', 'NEWS.md']
|
|
22
22
|
|
|
23
|
-
s.required_ruby_version = '>= 2
|
|
23
|
+
s.required_ruby_version = '>= 3.2'
|
|
24
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
|
24
25
|
end
|
data/ddenv.yaml
ADDED
data/lib/d-mark/parser.rb
CHANGED
|
@@ -14,13 +14,17 @@ module DMark
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def fancy_message
|
|
17
|
+
extended_message
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def extended_message
|
|
17
21
|
line = @content.lines[line_nr]
|
|
18
22
|
|
|
19
23
|
lines = [
|
|
20
24
|
message,
|
|
21
25
|
'',
|
|
22
26
|
line.rstrip,
|
|
23
|
-
"\e[31m" + ' ' * [col_nr, 0].max + '↑' + "\e[0m"
|
|
27
|
+
"\e[31m" + (' ' * [col_nr - 1, 0].max) + '↑' + "\e[0m"
|
|
24
28
|
]
|
|
25
29
|
|
|
26
30
|
lines.join("\n")
|
|
@@ -80,11 +84,11 @@ module DMark
|
|
|
80
84
|
|
|
81
85
|
def read_char(expected_char)
|
|
82
86
|
char = @input_chars[@pos]
|
|
83
|
-
if char
|
|
84
|
-
raise_parse_error("expected #{expected_char.inspect}, but got #{char.nil? ? 'EOF' : char.inspect}")
|
|
85
|
-
else
|
|
87
|
+
if char == expected_char
|
|
86
88
|
advance
|
|
87
89
|
char
|
|
90
|
+
else
|
|
91
|
+
raise_parse_error("expected #{expected_char.inspect}, but got #{char.nil? ? 'EOF' : char.inspect}")
|
|
88
92
|
end
|
|
89
93
|
end
|
|
90
94
|
|
|
@@ -140,7 +144,7 @@ module DMark
|
|
|
140
144
|
end
|
|
141
145
|
|
|
142
146
|
# FIXME: ugly and duplicated
|
|
143
|
-
def try_read_block_start
|
|
147
|
+
def try_read_block_start # rubocop:disable Naming/PredicateMethod
|
|
144
148
|
if @input_chars[@pos] == '#'
|
|
145
149
|
next_char = @input_chars[@pos + 1]
|
|
146
150
|
('a'..'z').cover?(next_char)
|
data/lib/d-mark/translator.rb
CHANGED
|
@@ -4,6 +4,7 @@ module DMark
|
|
|
4
4
|
attr_reader :node
|
|
5
5
|
|
|
6
6
|
def initialize(node)
|
|
7
|
+
super(message)
|
|
7
8
|
@node = node
|
|
8
9
|
end
|
|
9
10
|
|
|
@@ -24,7 +25,7 @@ module DMark
|
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
def translate(nodes, context = {})
|
|
27
|
-
[nodes.map { |node| handle(node, context) }].
|
|
28
|
+
[nodes.map { |node| handle(node, context) }].join
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
def handle(node, context = {})
|
data/lib/d-mark/version.rb
CHANGED
|
@@ -8,45 +8,50 @@ describe DMark::ElementNode do
|
|
|
8
8
|
describe '#inspect' do
|
|
9
9
|
subject { element_node.inspect }
|
|
10
10
|
|
|
11
|
-
context '
|
|
11
|
+
context 'without attributes' do
|
|
12
12
|
let(:attributes) { {} }
|
|
13
13
|
|
|
14
14
|
it { is_expected.to eql('Element(para, ["Hello!"])') }
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
context 'attributes' do
|
|
17
|
+
context 'with attributes' do
|
|
18
18
|
let(:attributes) { { 'only' => 'web' } }
|
|
19
19
|
|
|
20
|
-
it { is_expected.to eql('Element(para, {"only"=>"web"}, ["Hello!"])') }
|
|
20
|
+
it { is_expected.to eql('Element(para, {"only" => "web"}, ["Hello!"])') }
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
describe '#==' do
|
|
25
25
|
subject { element_node == other }
|
|
26
26
|
|
|
27
|
-
context 'other is not an element node' do
|
|
27
|
+
context 'when other is not an element node' do
|
|
28
28
|
let(:other) { 'donkey' }
|
|
29
|
+
|
|
29
30
|
it { is_expected.to be false }
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
context 'other is an element node' do
|
|
33
|
-
context 'other does not differ' do
|
|
33
|
+
context 'when other is an element node' do
|
|
34
|
+
context 'when other does not differ' do
|
|
34
35
|
let(:other) { described_class.new(name, attributes, children) }
|
|
36
|
+
|
|
35
37
|
it { is_expected.to be true }
|
|
36
38
|
end
|
|
37
39
|
|
|
38
|
-
context 'other differs in name' do
|
|
40
|
+
context 'when other differs in name' do
|
|
39
41
|
let(:other) { described_class.new('giraffe', attributes, children) }
|
|
42
|
+
|
|
40
43
|
it { is_expected.to be false }
|
|
41
44
|
end
|
|
42
45
|
|
|
43
|
-
context 'other differs in attributes' do
|
|
46
|
+
context 'when other differs in attributes' do
|
|
44
47
|
let(:other) { described_class.new(name, { 'friend' => 'donkey' }, children) }
|
|
48
|
+
|
|
45
49
|
it { is_expected.to be false }
|
|
46
50
|
end
|
|
47
51
|
|
|
48
|
-
context 'other differs in children' do
|
|
52
|
+
context 'when other differs in children' do
|
|
49
53
|
let(:other) { described_class.new(name, attributes, []) }
|
|
54
|
+
|
|
50
55
|
it { is_expected.to be false }
|
|
51
56
|
end
|
|
52
57
|
end
|
data/spec/d-mark/parser_spec.rb
CHANGED
|
@@ -26,7 +26,13 @@ describe DMark::Parser::ParserError do
|
|
|
26
26
|
describe '#fancy_message' do
|
|
27
27
|
subject { error.fancy_message }
|
|
28
28
|
|
|
29
|
-
it { is_expected.to eq("parse error at line 3, col 15: unexpected } -- try escaping it as \"%}\"\n\n#p More stuff }\n\e[31m
|
|
29
|
+
it { is_expected.to eq("parse error at line 3, col 15: unexpected } -- try escaping it as \"%}\"\n\n#p More stuff }\n\e[31m ↑\e[0m") }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe '#extended_message' do
|
|
33
|
+
subject { error.extended_message }
|
|
34
|
+
|
|
35
|
+
it { is_expected.to eq("parse error at line 3, col 15: unexpected } -- try escaping it as \"%}\"\n\n#p More stuff }\n\e[31m ↑\e[0m") }
|
|
30
36
|
end
|
|
31
37
|
end
|
|
32
38
|
|
|
@@ -257,15 +263,15 @@ describe 'DMark::Parser#parser' do
|
|
|
257
263
|
]
|
|
258
264
|
end
|
|
259
265
|
|
|
260
|
-
it 'does not parse
|
|
266
|
+
it 'does not parse attributes starting with -' do
|
|
261
267
|
expect { parse('#p[-this=is dog] hello yes') }.to raise_error(DMark::Parser::ParserError)
|
|
262
268
|
end
|
|
263
269
|
|
|
264
|
-
it 'does not parse
|
|
270
|
+
it 'does not parse attributes starting with _' do
|
|
265
271
|
expect { parse('#p[_this=is dog] hello yes') }.to raise_error(DMark::Parser::ParserError)
|
|
266
272
|
end
|
|
267
273
|
|
|
268
|
-
it 'does not parse
|
|
274
|
+
it 'does not parse attributes starting with a digit' do
|
|
269
275
|
expect { parse('#p[4this=is dog] hello yes') }.to raise_error(DMark::Parser::ParserError)
|
|
270
276
|
end
|
|
271
277
|
|
|
@@ -16,7 +16,7 @@ describe DMark::Translator do
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
shared_examples 'translates' do
|
|
19
|
-
context 'translator base class' do
|
|
19
|
+
context 'with translator base class' do
|
|
20
20
|
it 'raises error' do
|
|
21
21
|
expect { subject }.to raise_error(
|
|
22
22
|
DMark::Translator::UnhandledNode,
|
|
@@ -25,7 +25,7 @@ describe DMark::Translator do
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
context 'custom translator' do
|
|
28
|
+
context 'with custom translator' do
|
|
29
29
|
let(:translator_class) do
|
|
30
30
|
Class.new(described_class) do
|
|
31
31
|
def handle_string(string, _context)
|
|
@@ -46,7 +46,7 @@ describe DMark::Translator do
|
|
|
46
46
|
|
|
47
47
|
it { is_expected.to eql('<para only=web animal=donkey><em>Hello</em> world!</para>') }
|
|
48
48
|
|
|
49
|
-
context 'doing something with context' do
|
|
49
|
+
context 'when doing something with context' do
|
|
50
50
|
let(:translator_class) do
|
|
51
51
|
Class.new(described_class) do
|
|
52
52
|
def handle_string(string, context)
|
|
@@ -81,20 +81,24 @@ describe DMark::Translator do
|
|
|
81
81
|
|
|
82
82
|
describe '.translate' do
|
|
83
83
|
subject { translator_class.translate(nodes) }
|
|
84
|
+
|
|
84
85
|
include_examples 'translates'
|
|
85
86
|
|
|
86
|
-
context 'unrecognised type' do
|
|
87
|
+
context 'with unrecognised type' do
|
|
87
88
|
subject { translator_class.translate([:donkey]) }
|
|
89
|
+
|
|
88
90
|
include_examples 'errors on unknown type'
|
|
89
91
|
end
|
|
90
92
|
end
|
|
91
93
|
|
|
92
94
|
describe '#translate' do
|
|
93
95
|
subject { translator.translate(nodes) }
|
|
96
|
+
|
|
94
97
|
include_examples 'translates'
|
|
95
98
|
|
|
96
|
-
context 'unrecognised type' do
|
|
99
|
+
context 'with unrecognised type' do
|
|
97
100
|
subject { translator.translate([:donkey]) }
|
|
101
|
+
|
|
98
102
|
include_examples 'errors on unknown type'
|
|
99
103
|
end
|
|
100
104
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: d-mark
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.0b3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis Defreyne
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: D★Mark is a markup language aimed at being able to write semantically
|
|
14
13
|
meaningful text without limiting itself to the semantics provided by HTML or Markdown.
|
|
@@ -17,8 +16,8 @@ executables: []
|
|
|
17
16
|
extensions: []
|
|
18
17
|
extra_rdoc_files:
|
|
19
18
|
- LICENSE
|
|
20
|
-
- README.md
|
|
21
19
|
- NEWS.md
|
|
20
|
+
- README.md
|
|
22
21
|
files:
|
|
23
22
|
- Gemfile
|
|
24
23
|
- Gemfile.lock
|
|
@@ -28,6 +27,7 @@ files:
|
|
|
28
27
|
- README.md
|
|
29
28
|
- Rakefile
|
|
30
29
|
- d-mark.gemspec
|
|
30
|
+
- ddenv.yaml
|
|
31
31
|
- ideas.dmark
|
|
32
32
|
- lib/d-mark.rb
|
|
33
33
|
- lib/d-mark/element_node.rb
|
|
@@ -43,8 +43,8 @@ files:
|
|
|
43
43
|
homepage: http://rubygems.org/gems/d-mark
|
|
44
44
|
licenses:
|
|
45
45
|
- MIT
|
|
46
|
-
metadata:
|
|
47
|
-
|
|
46
|
+
metadata:
|
|
47
|
+
rubygems_mfa_required: 'true'
|
|
48
48
|
rdoc_options:
|
|
49
49
|
- "--main"
|
|
50
50
|
- README.md
|
|
@@ -54,15 +54,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
54
54
|
requirements:
|
|
55
55
|
- - ">="
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: '2
|
|
57
|
+
version: '3.2'
|
|
58
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
59
|
requirements:
|
|
60
|
-
- - "
|
|
60
|
+
- - ">="
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version:
|
|
62
|
+
version: '0'
|
|
63
63
|
requirements: []
|
|
64
|
-
rubygems_version: 3.
|
|
65
|
-
signing_key:
|
|
64
|
+
rubygems_version: 3.6.9
|
|
66
65
|
specification_version: 4
|
|
67
66
|
summary: markup language for writing text
|
|
68
67
|
test_files: []
|