d-mark 1.0.0a4 → 1.0.0b1

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
- SHA1:
3
- metadata.gz: bd186ea6e5e8fb14c4c424b8a58793026a0a650b
4
- data.tar.gz: cd847b7b9029f0098b3e10b3a7ba74f3b97aaad3
2
+ SHA256:
3
+ metadata.gz: 30e167e90d0b60c800ba346d0f605a6d18410266f3ef5346b9d0e5433b9f41a3
4
+ data.tar.gz: 7c91d1faf7e6031e39e1178bdb83a2f20e47abb8323069f84439f85cbd2a68f7
5
5
  SHA512:
6
- metadata.gz: 19198cab18de6924374fddeb55f0bec8e4db2e78b62caa7417ec9d6dec5189d9b5c275ab1bc58712fa39db00ef66993aa2e1b5c85cd10222492746655dff5d1f
7
- data.tar.gz: 5256a0b8ac59bdf95891d4135a5ee2f6b9002e5bd5975aa1c9561f7def7a9453e90e00c007cbb4f14c45be2bf2f08e229ec0ed36602232e67ad67448fcbae631
6
+ metadata.gz: c0708a7a4a2d7be5f117f11b2f6e573131211642eb072163c8aeaa14628ee843f0feae89c4a05138e0b0ab66b9956627231727c61843e419337544a962a75768
7
+ data.tar.gz: f04d93d9b19243c8a641ecee84bfb181a6a4313a82e6a3a087bd9ae8b6c259a86518433e2bf169813dea2d69e2de02df29045c0ad488bbd0a90716d56aa6285e
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- d-mark (1.0.0a3)
4
+ d-mark (1.0.0b1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.3.0)
9
+ ast (2.4.0)
10
10
  codecov (0.1.10)
11
11
  json
12
12
  simplecov
13
13
  url
14
- coderay (1.1.1)
14
+ coderay (1.1.2)
15
15
  diff-lcs (1.3)
16
16
  docile (1.1.5)
17
- ffi (1.9.18)
17
+ ffi (1.9.23)
18
18
  formatador (0.2.5)
19
- guard (2.14.1)
19
+ guard (2.14.2)
20
20
  formatador (>= 0.2.4)
21
21
  listen (>= 2.7, < 4.0)
22
- lumberjack (~> 1.0)
22
+ lumberjack (>= 1.0.12, < 2.0)
23
23
  nenv (~> 0.1)
24
24
  notiffany (~> 0.0)
25
25
  pry (>= 0.9.12)
@@ -34,54 +34,51 @@ GEM
34
34
  rb-inotify (~> 0.9, >= 0.9.7)
35
35
  ruby_dep (~> 1.2)
36
36
  lumberjack (1.0.12)
37
- method_source (0.8.2)
37
+ method_source (0.9.0)
38
38
  nenv (0.3.0)
39
39
  notiffany (0.1.1)
40
40
  nenv (~> 0.1)
41
41
  shellany (~> 0.0)
42
- parallel (1.12.0)
43
- parser (2.4.0.0)
44
- ast (~> 2.2)
42
+ parallel (1.12.1)
43
+ parser (2.5.0.2)
44
+ ast (~> 2.4.0)
45
45
  powerpack (0.1.1)
46
- pry (0.10.4)
46
+ pry (0.11.3)
47
47
  coderay (~> 1.1.0)
48
- method_source (~> 0.8.1)
49
- slop (~> 3.4)
50
- rainbow (2.2.2)
51
- rake
52
- rake (12.0.0)
48
+ method_source (~> 0.9.0)
49
+ rainbow (3.0.0)
50
+ rake (12.3.0)
53
51
  rb-fsevent (0.10.2)
54
52
  rb-inotify (0.9.10)
55
53
  ffi (>= 0.5.0, < 2)
56
- rspec (3.6.0)
57
- rspec-core (~> 3.6.0)
58
- rspec-expectations (~> 3.6.0)
59
- rspec-mocks (~> 3.6.0)
60
- rspec-core (3.6.0)
61
- rspec-support (~> 3.6.0)
62
- rspec-expectations (3.6.0)
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)
63
61
  diff-lcs (>= 1.2.0, < 2.0)
64
- rspec-support (~> 3.6.0)
65
- rspec-mocks (3.6.0)
62
+ rspec-support (~> 3.7.0)
63
+ rspec-mocks (3.7.0)
66
64
  diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.6.0)
68
- rspec-support (3.6.0)
69
- rubocop (0.49.1)
65
+ rspec-support (~> 3.7.0)
66
+ rspec-support (3.7.1)
67
+ rubocop (0.52.1)
70
68
  parallel (~> 1.10)
71
- parser (>= 2.3.3.1, < 3.0)
69
+ parser (>= 2.4.0.2, < 3.0)
72
70
  powerpack (~> 0.1)
73
- rainbow (>= 1.99.1, < 3.0)
71
+ rainbow (>= 2.2.2, < 4.0)
74
72
  ruby-progressbar (~> 1.7)
75
73
  unicode-display_width (~> 1.0, >= 1.0.1)
76
- ruby-progressbar (1.8.1)
74
+ ruby-progressbar (1.9.0)
77
75
  ruby_dep (1.5.0)
78
76
  shellany (0.0.1)
79
- simplecov (0.15.0)
77
+ simplecov (0.15.1)
80
78
  docile (~> 1.1.0)
81
79
  json (>= 1.8, < 3)
82
80
  simplecov-html (~> 0.10.0)
83
81
  simplecov-html (0.10.2)
84
- slop (3.6.0)
85
82
  thor (0.20.0)
86
83
  unicode-display_width (1.3.0)
87
84
  url (0.3.2)
@@ -90,7 +87,6 @@ PLATFORMS
90
87
  ruby
91
88
 
92
89
  DEPENDENCIES
93
- bundler (>= 1.11.2, < 2.0)
94
90
  codecov
95
91
  d-mark!
96
92
  guard
@@ -99,4 +95,4 @@ DEPENDENCIES
99
95
  rubocop
100
96
 
101
97
  BUNDLED WITH
102
- 1.15.3
98
+ 1.16.1
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # D★Mark news
2
2
 
3
+ ## 1.0.0b1 (2018-02-26)
4
+
5
+ Enhancements:
6
+
7
+ * Added `ParserError#fancy_message`
8
+
3
9
  ## 1.0.0a4 (2017-08-19)
4
10
 
5
11
  Changes:
@@ -0,0 +1,20 @@
1
+ # D★Mark
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)
7
+
8
+ _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
+
10
+ If you’re a technical writer looking for a flexible markup language, D★Mark might be a good fit.
11
+
12
+ Here’s an example of D★Mark:
13
+
14
+ ```
15
+ #para This a paragraph; an element in block form containing some text.
16
+
17
+ #note[only=web] This is a note that will %em{only} show up on web.
18
+ ```
19
+
20
+ For details, see the [D★Mark web page](http://ddfreyne.github.io/d-mark/).
@@ -17,10 +17,8 @@ Gem::Specification.new do |s|
17
17
  ['d-mark.gemspec']
18
18
  s.require_paths = ['lib']
19
19
 
20
- s.rdoc_options = ['--main', 'README.adoc']
21
- s.extra_rdoc_files = ['LICENSE', 'README.adoc', 'NEWS.md']
20
+ s.rdoc_options = ['--main', 'README.md']
21
+ s.extra_rdoc_files = ['LICENSE', 'README.md', 'NEWS.md']
22
22
 
23
- s.required_ruby_version = '>= 2.2.0'
24
-
25
- s.add_development_dependency('bundler', '>= 1.11.2', '< 2.0')
23
+ s.required_ruby_version = '~> 2.3'
26
24
  end
@@ -4,18 +4,33 @@ module DMark
4
4
  attr_reader :line_nr
5
5
  attr_reader :col_nr
6
6
 
7
- def initialize(line_nr, col_nr, msg)
7
+ def initialize(line_nr, col_nr, msg, content)
8
8
  @line_nr = line_nr
9
9
  @col_nr = col_nr
10
10
  @msg = msg
11
+ @content = content
11
12
 
12
13
  super("parse error at line #{@line_nr + 1}, col #{@col_nr + 1}: #{@msg}")
13
14
  end
15
+
16
+ def fancy_message
17
+ line = @content.lines[line_nr]
18
+
19
+ lines = [
20
+ message,
21
+ '',
22
+ line.rstrip,
23
+ "\e[31m" + ' ' * [col_nr, 0].max + '↑' + "\e[0m"
24
+ ]
25
+
26
+ lines.join("\n")
27
+ end
14
28
  end
15
29
 
16
30
  attr_reader :pos
17
31
 
18
32
  def initialize(input)
33
+ @input = input
19
34
  @input_chars = input.chars
20
35
  @length = @input_chars.size
21
36
 
@@ -368,7 +383,7 @@ module DMark
368
383
  end
369
384
 
370
385
  def raise_parse_error(msg)
371
- raise ParserError.new(@line_nr, @col_nr, msg)
386
+ raise ParserError.new(@line_nr, @col_nr, msg, @input)
372
387
  end
373
388
  end
374
389
  end
@@ -1,3 +1,3 @@
1
1
  module DMark
2
- VERSION = '1.0.0a4'.freeze
2
+ VERSION = '1.0.0b1'.freeze
3
3
  end
@@ -6,6 +6,32 @@ def element(name, attributes, children)
6
6
  DMark::ElementNode.new(name, attributes, children)
7
7
  end
8
8
 
9
+ describe DMark::Parser::ParserError do
10
+ subject(:error) do
11
+ begin
12
+ DMark::Parser.new(content).parse
13
+ rescue described_class => e
14
+ break e
15
+ end
16
+ end
17
+
18
+ let(:content) do
19
+ "#p Stuff\n\n#p More stuff }"
20
+ end
21
+
22
+ describe '#message' do
23
+ subject { error.message }
24
+
25
+ it { is_expected.to eq('parse error at line 3, col 15: unexpected } -- try escaping it as "%}"') }
26
+ end
27
+
28
+ describe '#fancy_message' do
29
+ subject { error.fancy_message }
30
+
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") }
32
+ end
33
+ end
34
+
9
35
  describe 'DMark::Parser#parser' do
10
36
  it 'parses' do
11
37
  expect(parse('')).to eq []
metadata CHANGED
@@ -1,35 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: d-mark
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0a4
4
+ version: 1.0.0b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-19 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 1.11.2
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '2.0'
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 1.11.2
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '2.0'
11
+ date: 2018-02-26 00:00:00.000000000 Z
12
+ dependencies: []
33
13
  description: D★Mark is a markup language aimed at being able to write semantically
34
14
  meaningful text without limiting itself to the semantics provided by HTML or Markdown.
35
15
  email: denis.defreyne@stoneship.org
@@ -37,7 +17,7 @@ executables: []
37
17
  extensions: []
38
18
  extra_rdoc_files:
39
19
  - LICENSE
40
- - README.adoc
20
+ - README.md
41
21
  - NEWS.md
42
22
  files:
43
23
  - Gemfile
@@ -45,7 +25,7 @@ files:
45
25
  - Guardfile
46
26
  - LICENSE
47
27
  - NEWS.md
48
- - README.adoc
28
+ - README.md
49
29
  - Rakefile
50
30
  - d-mark.gemspec
51
31
  - lib/d-mark.rb
@@ -66,14 +46,14 @@ metadata: {}
66
46
  post_install_message:
67
47
  rdoc_options:
68
48
  - "--main"
69
- - README.adoc
49
+ - README.md
70
50
  require_paths:
71
51
  - lib
72
52
  required_ruby_version: !ruby/object:Gem::Requirement
73
53
  requirements:
74
- - - ">="
54
+ - - "~>"
75
55
  - !ruby/object:Gem::Version
76
- version: 2.2.0
56
+ version: '2.3'
77
57
  required_rubygems_version: !ruby/object:Gem::Requirement
78
58
  requirements:
79
59
  - - ">"
@@ -81,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
61
  version: 1.3.1
82
62
  requirements: []
83
63
  rubyforge_project:
84
- rubygems_version: 2.6.12
64
+ rubygems_version: 2.7.6
85
65
  signing_key:
86
66
  specification_version: 4
87
67
  summary: markup language for writing text
@@ -1,22 +0,0 @@
1
- = D★Mark
2
- Denis Defreyne <denis@stoneship.org>
3
-
4
- image:http://img.shields.io/gem/v/d-mark.svg[Gem version, link="http://rubygems.org/gems/d-mark"]
5
- image:http://img.shields.io/travis/ddfreyne/d-mark.svg[Build status, link="https://travis-ci.org/ddfreyne/d-mark"]
6
- image:http://img.shields.io/codeclimate/github/ddfreyne/d-mark.svg[Code Climate, link="https://codeclimate.com/github/ddfreyne/d-mark"]
7
- image:http://img.shields.io/codecov/c/github/ddfreyne/d-mark.svg[Code Coverage, link="https://codecov.io/github/ddfreyne/d-mark"]
8
-
9
- _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.
10
-
11
- If you’re a technical writer looking for a flexible markup language, D★Mark might be a good fit.
12
-
13
- Here’s an example of D★Mark:
14
-
15
- [source]
16
- ----
17
- para. This a paragraph; an element in block form containing some text.
18
-
19
- note[only=web]. This is a note that will %em{only} show up on web.
20
- ----
21
-
22
- For details, see the http://ddfreyne.github.io/d-mark/[D★Mark web page].