d-mark 1.0.0b1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30e167e90d0b60c800ba346d0f605a6d18410266f3ef5346b9d0e5433b9f41a3
4
- data.tar.gz: 7c91d1faf7e6031e39e1178bdb83a2f20e47abb8323069f84439f85cbd2a68f7
3
+ metadata.gz: b41f64c853bc4220552bf0d050aea2194786a51d682ca3c64a0ffa3d941e31f4
4
+ data.tar.gz: 9ab2309f47041fccd48bb1487f10e04a62cca86a8f2b5745805edf08bb584584
5
5
  SHA512:
6
- metadata.gz: c0708a7a4a2d7be5f117f11b2f6e573131211642eb072163c8aeaa14628ee843f0feae89c4a05138e0b0ab66b9956627231727c61843e419337544a962a75768
7
- data.tar.gz: f04d93d9b19243c8a641ecee84bfb181a6a4313a82e6a3a087bd9ae8b6c259a86518433e2bf169813dea2d69e2de02df29045c0ad488bbd0a90716d56aa6285e
6
+ metadata.gz: 1d3394cf204fff4e738737eb5cc6acf059e216469ca4fbabfa17c728cc0aff88fda7137c27e4b2c7ca7a6d434e6b7c0adb2caf5dea9501015bc46173eac0e471
7
+ data.tar.gz: 778c81bca44884846af47f83d7902ba0b7a8681d6965325d36e653399564c438cd13a955ddd685f90975ce156e6a46c0574b08775b66abf877cf8a2dbadb81a2
data/Gemfile CHANGED
@@ -2,8 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'codecov', require: false
6
5
  gem 'guard'
7
6
  gem 'guard-rake'
8
7
  gem 'rspec'
9
8
  gem 'rubocop'
9
+ gem 'rubocop-rspec', '~> 2.1'
data/Gemfile.lock CHANGED
@@ -1,98 +1,198 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- d-mark (1.0.0b1)
4
+ d-mark (1.0.0b3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
10
- codecov (0.1.10)
11
- json
12
- simplecov
13
- url
14
- coderay (1.1.2)
15
- diff-lcs (1.3)
16
- docile (1.1.5)
17
- ffi (1.9.23)
18
- formatador (0.2.5)
19
- guard (2.14.2)
9
+ ast (2.4.3)
10
+ coderay (1.1.3)
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)
20
26
  formatador (>= 0.2.4)
21
27
  listen (>= 2.7, < 4.0)
28
+ logger (~> 1.6)
22
29
  lumberjack (>= 1.0.12, < 2.0)
23
30
  nenv (~> 0.1)
24
31
  notiffany (~> 0.0)
25
- pry (>= 0.9.12)
32
+ ostruct (~> 0.6)
33
+ pry (>= 0.13.0)
26
34
  shellany (~> 0.0)
27
35
  thor (>= 0.18.1)
28
36
  guard-rake (1.0.0)
29
37
  guard
30
38
  rake
31
- json (2.1.0)
32
- listen (3.1.5)
33
- rb-fsevent (~> 0.9, >= 0.9.4)
34
- rb-inotify (~> 0.9, >= 0.9.7)
35
- ruby_dep (~> 1.2)
36
- lumberjack (1.0.12)
37
- method_source (0.9.0)
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)
44
+ rb-fsevent (~> 0.10, >= 0.10.3)
45
+ rb-inotify (~> 0.9, >= 0.9.10)
46
+ logger (1.7.0)
47
+ lumberjack (1.4.2)
48
+ method_source (1.1.0)
38
49
  nenv (0.3.0)
39
- notiffany (0.1.1)
50
+ notiffany (0.1.3)
40
51
  nenv (~> 0.1)
41
52
  shellany (~> 0.0)
42
- parallel (1.12.1)
43
- parser (2.5.0.2)
44
- ast (~> 2.4.0)
45
- powerpack (0.1.1)
46
- pry (0.11.3)
47
- coderay (~> 1.1.0)
48
- method_source (~> 0.9.0)
49
- rainbow (3.0.0)
50
- rake (12.3.0)
51
- rb-fsevent (0.10.2)
52
- rb-inotify (0.9.10)
53
- ffi (>= 0.5.0, < 2)
54
- rspec (3.7.0)
55
- rspec-core (~> 3.7.0)
56
- rspec-expectations (~> 3.7.0)
57
- rspec-mocks (~> 3.7.0)
58
- rspec-core (3.7.1)
59
- rspec-support (~> 3.7.0)
60
- rspec-expectations (3.7.0)
53
+ ostruct (0.6.3)
54
+ parallel (1.27.0)
55
+ parser (3.3.10.0)
56
+ ast (~> 2.4.1)
57
+ racc
58
+ prism (1.6.0)
59
+ pry (0.15.2)
60
+ coderay (~> 1.1)
61
+ method_source (~> 1.0)
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)
67
+ ffi (~> 1.0)
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)
61
78
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.7.0)
63
- rspec-mocks (3.7.0)
79
+ rspec-support (~> 3.13.0)
80
+ rspec-mocks (3.13.7)
64
81
  diff-lcs (>= 1.2.0, < 2.0)
65
- rspec-support (~> 3.7.0)
66
- rspec-support (3.7.1)
67
- rubocop (0.52.1)
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)
68
88
  parallel (~> 1.10)
69
- parser (>= 2.4.0.2, < 3.0)
70
- powerpack (~> 0.1)
89
+ parser (>= 3.3.0.2)
71
90
  rainbow (>= 2.2.2, < 4.0)
91
+ regexp_parser (>= 2.9.3, < 3.0)
92
+ rubocop-ast (>= 1.47.1, < 2.0)
72
93
  ruby-progressbar (~> 1.7)
73
- unicode-display_width (~> 1.0, >= 1.0.1)
74
- ruby-progressbar (1.9.0)
75
- ruby_dep (1.5.0)
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)
76
112
  shellany (0.0.1)
77
- simplecov (0.15.1)
78
- docile (~> 1.1.0)
79
- json (>= 1.8, < 3)
80
- simplecov-html (~> 0.10.0)
81
- simplecov-html (0.10.2)
82
- thor (0.20.0)
83
- unicode-display_width (1.3.0)
84
- url (0.3.2)
113
+ thor (1.4.0)
114
+ unicode-display_width (3.2.0)
115
+ unicode-emoji (~> 4.1)
116
+ unicode-emoji (4.1.0)
85
117
 
86
118
  PLATFORMS
119
+ aarch64-linux-gnu
120
+ aarch64-linux-musl
121
+ arm-linux-gnu
122
+ arm-linux-musl
123
+ arm64-darwin
87
124
  ruby
125
+ x86-linux-gnu
126
+ x86-linux-musl
127
+ x86_64-darwin
128
+ x86_64-linux-gnu
129
+ x86_64-linux-musl
88
130
 
89
131
  DEPENDENCIES
90
- codecov
91
132
  d-mark!
92
133
  guard
93
134
  guard-rake
94
135
  rspec
95
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
96
196
 
97
197
  BUNDLED WITH
98
- 1.16.1
198
+ 2.7.2
data/NEWS.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # D★Mark news
2
2
 
3
+ ## 1.0.0b3 (2025-11-27)
4
+
5
+ Enhancements:
6
+
7
+ * Added `ParserError#extended_message`
8
+
9
+ Fixes:
10
+
11
+ * Fix wrong (one-off) error indicator
12
+
13
+ ## 1.0.0b2 (2021-01-01)
14
+
15
+ Enhancements:
16
+
17
+ * Added support for Ruby 3.x
18
+
3
19
  ## 1.0.0b1 (2018-02-26)
4
20
 
5
21
  Enhancements:
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # D★Mark
2
2
 
3
- [![Gem version](http://img.shields.io/gem/v/d-mark.svg)](http://rubygems.org/gems/d-mark)
4
- [![Build status](http://img.shields.io/travis/ddfreyne/d-mark.svg)](https://travis-ci.org/ddfreyne/d-mark)
5
- [![Code Climate](http://img.shields.io/codeclimate/github/ddfreyne/d-mark.svg)](https://codeclimate.com/github/ddfreyne/d-mark)
6
- [![Code Coverage](http://img.shields.io/codecov/c/github/ddfreyne/d-mark.svg)](https://codecov.io/github/ddfreyne/d-mark)
3
+ [![Gem version](https://img.shields.io/gem/v/d-mark.svg)](http://rubygems.org/gems/d-mark)
4
+ ![Build status](https://img.shields.io/github/checks-status/denisdefreyne/d-mark/main)
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://ddfreyne.github.io/d-mark/).
18
+ For details, see the [D★Mark web page](http://denisdefreyne.github.io/d-mark/).
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ end
8
8
 
9
9
  RuboCop::RakeTask.new(:rubocop) do |task|
10
10
  task.options = %w[--display-cop-names --format simple]
11
- task.patterns = ['lib/**/*.rb', 'spec/**/*.rb', 'Gemfile*', '*.gemspec', 'Rakefile']
11
+ task.patterns = ['lib/**/*.rb', 'spec/**/*.rb', 'Gemfile', '*.gemspec', 'Rakefile']
12
12
  end
13
13
 
14
14
  task default: %i[spec rubocop]
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.3'
23
+ s.required_ruby_version = '>= 3.2'
24
+ s.metadata['rubygems_mfa_required'] = 'true'
24
25
  end
data/ddenv.yaml ADDED
@@ -0,0 +1,3 @@
1
+ up:
2
+ - ruby
3
+ - bundle
data/ideas.dmark ADDED
@@ -0,0 +1,17 @@
1
+ #h1 Ideas
2
+
3
+ #ul
4
+ #li
5
+ #p Support validation. Which elements can contain which other elements? Which elements can live at the root?
6
+
7
+ #li
8
+ #p Have different translators built-in. I’m thinking %code{BasicMarkdown2HTML} and %code{HTMLForWriters2HTML}, and perhaps %code{DocBook2HTML}.
9
+
10
+ #li
11
+ #p A refactored parser that does not need to reset %code{@pos}, and maybe not even have any kind of mutable state at all.
12
+
13
+ #li
14
+ #p Fancy exception handling actually used somewhere.
15
+
16
+ #li
17
+ #p Documentation for every exception that occurs.
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")
@@ -55,6 +59,7 @@ module DMark
55
59
 
56
60
  loop do
57
61
  break if eof?
62
+
58
63
  res << read_block_with_children
59
64
  end
60
65
 
@@ -77,13 +82,13 @@ module DMark
77
82
  @col_nr += 1
78
83
  end
79
84
 
80
- def read_char(c)
85
+ def read_char(expected_char)
81
86
  char = @input_chars[@pos]
82
- if char != c
83
- raise_parse_error("expected #{c.inspect}, but got #{char.nil? ? 'EOF' : char.inspect}")
84
- else
87
+ if char == expected_char
85
88
  advance
86
89
  char
90
+ else
91
+ raise_parse_error("expected #{expected_char.inspect}, but got #{char.nil? ? 'EOF' : char.inspect}")
87
92
  end
88
93
  end
89
94
 
@@ -139,7 +144,7 @@ module DMark
139
144
  end
140
145
 
141
146
  # FIXME: ugly and duplicated
142
- def try_read_block_start
147
+ def try_read_block_start # rubocop:disable Naming/PredicateMethod
143
148
  if @input_chars[@pos] == '#'
144
149
  next_char = @input_chars[@pos + 1]
145
150
  ('a'..'z').cover?(next_char)
@@ -232,6 +237,7 @@ module DMark
232
237
  loop do
233
238
  char = @input_chars[@pos]
234
239
  break unless IDENTIFIER_CHARS.include?(char)
240
+
235
241
  advance
236
242
  res << char
237
243
  end
@@ -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) }].flatten.join('')
28
+ [nodes.map { |node| handle(node, context) }].join
28
29
  end
29
30
 
30
31
  def handle(node, context = {})
@@ -1,3 +1,3 @@
1
1
  module DMark
2
- VERSION = '1.0.0b1'.freeze
2
+ VERSION = '1.0.0b3'.freeze
3
3
  end
@@ -8,45 +8,50 @@ describe DMark::ElementNode do
8
8
  describe '#inspect' do
9
9
  subject { element_node.inspect }
10
10
 
11
- context 'no attributes' do
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
@@ -1,5 +1,5 @@
1
- def parse(s)
2
- DMark::Parser.new(s).parse
1
+ def parse(str)
2
+ DMark::Parser.new(str).parse
3
3
  end
4
4
 
5
5
  def element(name, attributes, children)
@@ -8,11 +8,9 @@ end
8
8
 
9
9
  describe DMark::Parser::ParserError do
10
10
  subject(:error) do
11
- begin
12
- DMark::Parser.new(content).parse
13
- rescue described_class => e
14
- break e
15
- end
11
+ DMark::Parser.new(content).parse
12
+ rescue described_class => e
13
+ break e
16
14
  end
17
15
 
18
16
  let(:content) do
@@ -28,7 +26,13 @@ describe DMark::Parser::ParserError do
28
26
  describe '#fancy_message' do
29
27
  subject { error.fancy_message }
30
28
 
31
- 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") }
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") }
32
36
  end
33
37
  end
34
38
 
@@ -259,15 +263,15 @@ describe 'DMark::Parser#parser' do
259
263
  ]
260
264
  end
261
265
 
262
- it 'does not parse atttributes starting with -' do
266
+ it 'does not parse attributes starting with -' do
263
267
  expect { parse('#p[-this=is dog] hello yes') }.to raise_error(DMark::Parser::ParserError)
264
268
  end
265
269
 
266
- it 'does not parse atttributes starting with _' do
270
+ it 'does not parse attributes starting with _' do
267
271
  expect { parse('#p[_this=is dog] hello yes') }.to raise_error(DMark::Parser::ParserError)
268
272
  end
269
273
 
270
- it 'does not parse atttributes starting with a digit' do
274
+ it 'does not parse attributes starting with a digit' do
271
275
  expect { parse('#p[4this=is dog] hello yes') }.to raise_error(DMark::Parser::ParserError)
272
276
  end
273
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
@@ -1,10 +1,3 @@
1
1
  require 'rspec'
2
2
 
3
- require 'simplecov'
4
- SimpleCov.start
5
- if ENV['CI'] == 'true'
6
- require 'codecov'
7
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
8
- end
9
-
10
3
  require 'd-mark'
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.0b1
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: 2018-02-26 00:00:00.000000000 Z
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,8 @@ files:
28
27
  - README.md
29
28
  - Rakefile
30
29
  - d-mark.gemspec
30
+ - ddenv.yaml
31
+ - ideas.dmark
31
32
  - lib/d-mark.rb
32
33
  - lib/d-mark/element_node.rb
33
34
  - lib/d-mark/parser.rb
@@ -42,8 +43,8 @@ files:
42
43
  homepage: http://rubygems.org/gems/d-mark
43
44
  licenses:
44
45
  - MIT
45
- metadata: {}
46
- post_install_message:
46
+ metadata:
47
+ rubygems_mfa_required: 'true'
47
48
  rdoc_options:
48
49
  - "--main"
49
50
  - README.md
@@ -51,18 +52,16 @@ require_paths:
51
52
  - lib
52
53
  required_ruby_version: !ruby/object:Gem::Requirement
53
54
  requirements:
54
- - - "~>"
55
+ - - ">="
55
56
  - !ruby/object:Gem::Version
56
- version: '2.3'
57
+ version: '3.2'
57
58
  required_rubygems_version: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - ">"
60
+ - - ">="
60
61
  - !ruby/object:Gem::Version
61
- version: 1.3.1
62
+ version: '0'
62
63
  requirements: []
63
- rubyforge_project:
64
- rubygems_version: 2.7.6
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: []