mark_maker 0.7.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +2 -1
- data/.travis.yml +1 -2
- data/CHANGELOG.md +13 -0
- data/README.md +68 -12
- data/bin/generate_readme.rb +43 -6
- data/lib/mark_maker/generator.rb +1 -1
- data/lib/mark_maker/version.rb +1 -1
- data/lib/mark_maker_string.rb +12 -1
- data/mark_maker.gemspec +2 -2
- data/test/test_headers.rb +47 -0
- data/test/test_mark_maker.rb +1 -1
- data/test/test_mark_maker_string.rb +0 -22
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a641fadb4fb218a1e037fcdcbbad94ea9c1f57cae4b983c80ffc2d761f311ee7
|
4
|
+
data.tar.gz: 17d05f4b5604756d270d5dd3cc17fff8253ad613432beaf387871fa6082177b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbc4f27993d6ec1fb2fd40fe24fb8df2bf25e1d46aec133bd578d6aabbec4437540d043740edabd1d503691398ea7e349f9ac24582ed7d3899bda6b3a083c698
|
7
|
+
data.tar.gz: 7bc3cfd8aab4061b8465494733e4eba269a0f4537a718062f124cdff6235910f7aa045be27370241b2139a4c09113e1aa4574661a63d19bf6cc2a41fa1818bf5
|
data/.ruby-version
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
2.
|
1
|
+
2.6
|
2
|
+
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
0.9.0
|
2
|
+
-----
|
3
|
+
|
4
|
+
- addressing security vulnerability associated with rake
|
5
|
+
- dropping support for ruby 1.x versions
|
6
|
+
- now calls for bundler 2
|
7
|
+
|
8
|
+
0.8.0
|
9
|
+
-----
|
10
|
+
- added header 4 thru 6 support
|
11
|
+
- fixed a bug in the image generation when using a title
|
12
|
+
- noted supported ruby versions in the readme, per travis config
|
13
|
+
|
1
14
|
0.7.0
|
2
15
|
-----
|
3
16
|
- added support for images
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
![MarkMaker build status](https://travis-ci.org/sn1de/mark_maker.svg?branch=master Build Status)
|
1
|
+
![MarkMaker build status](https://travis-ci.org/sn1de/mark_maker.svg?branch=master "Build Status")
|
2
2
|
|
3
3
|
MarkMaker
|
4
4
|
=========
|
@@ -64,12 +64,42 @@ code, emphasis, and strong are all handled by String methods.
|
|
64
64
|
Multi line and more complex conversions are handled by a Generator class.
|
65
65
|
|
66
66
|
### Header Example
|
67
|
-
'Let It Begin'.header1
|
68
67
|
|
69
|
-
|
68
|
+
The following ruby code ...
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
h = "Let It Begin"
|
72
|
+
puts h.header1
|
73
|
+
puts h.header2
|
74
|
+
puts h.header3
|
75
|
+
puts h.header4
|
76
|
+
puts h.header5
|
77
|
+
puts h.header6
|
78
|
+
```
|
79
|
+
|
80
|
+
Results in this generated markdown ...
|
81
|
+
```
|
82
|
+
Let It Begin
|
83
|
+
============
|
84
|
+
Let It Begin
|
85
|
+
------------
|
86
|
+
### Let It Begin
|
87
|
+
#### Let It Begin
|
88
|
+
##### Let It Begin
|
89
|
+
###### Let It Begin
|
90
|
+
```
|
91
|
+
|
92
|
+
Ultimately looking something like this (if your are viewing this on github or through some other markdown viewing method) ...
|
93
|
+
|
94
|
+
Let It Begin
|
95
|
+
============
|
96
|
+
Let It Begin
|
97
|
+
------------
|
98
|
+
### Let It Begin
|
99
|
+
#### Let It Begin
|
100
|
+
##### Let It Begin
|
101
|
+
###### Let It Begin
|
70
102
|
|
71
|
-
Let It Begin
|
72
|
-
============
|
73
103
|
|
74
104
|
### Bulleted List Example
|
75
105
|
|
@@ -157,14 +187,16 @@ puts total
|
|
157
187
|
|
158
188
|
### Table Example
|
159
189
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
190
|
+
```ruby
|
191
|
+
header, separator = gen.table_header("Col One", "Col Two", "Col Three")
|
192
|
+
puts header
|
193
|
+
puts separator
|
194
|
+
puts gen.table_row("First", "A", "$3.99")
|
195
|
+
puts gen.table_row("Second", "BC", "$14.00")
|
196
|
+
puts gen.table_row("Third", "DEFGH", "$1,034.50")
|
197
|
+
```
|
166
198
|
|
167
|
-
Produces this terribly ugly markdown ...
|
199
|
+
Produces this terribly ugly markdown (but standby, there is a better way below) ...
|
168
200
|
|
169
201
|
```
|
170
202
|
|Col One|Col Two|Col Three|
|
@@ -248,3 +280,27 @@ existing README.md
|
|
248
280
|
|
249
281
|
I'm calling this Extreme [Readme Driven Development](http://tom.preston-werner.com/2010/08/23/readme-driven-development.html).
|
250
282
|
It's kind of like [Inception](http://en.wikipedia.org/wiki/Inception) ;)
|
283
|
+
|
284
|
+
Supported Ruby Versions
|
285
|
+
-----------------------
|
286
|
+
|
287
|
+
The following ruby versions are explicitly supported (see .travis.yml)
|
288
|
+
|
289
|
+
- 2.3.0
|
290
|
+
- 2.2.4
|
291
|
+
- 1.9.3
|
292
|
+
- ruby-head
|
293
|
+
|
294
|
+
Release Process
|
295
|
+
---------------
|
296
|
+
|
297
|
+
Document release changes in `CHANGELOG.md`
|
298
|
+
|
299
|
+
Increment the VERSION number in `lib/mark_maker/version.rb`
|
300
|
+
|
301
|
+
Run `rake release` which will:
|
302
|
+
|
303
|
+
- build the gem into the `pkg/` director
|
304
|
+
- create a git tag for the version
|
305
|
+
- push to github
|
306
|
+
- push the packaged gem to rubygems
|
data/bin/generate_readme.rb
CHANGED
@@ -87,10 +87,27 @@ puts ""
|
|
87
87
|
puts "Multi line and more complex conversions are handled by a Generator class."
|
88
88
|
puts ""
|
89
89
|
puts "Header Example".header3
|
90
|
-
|
91
|
-
puts "
|
92
|
-
puts "
|
93
|
-
|
90
|
+
puts ""
|
91
|
+
puts "The following ruby code ..."
|
92
|
+
puts ""
|
93
|
+
header_code = <<-EOT
|
94
|
+
h = "Let It Begin"
|
95
|
+
puts h.header1
|
96
|
+
puts h.header2
|
97
|
+
puts h.header3
|
98
|
+
puts h.header4
|
99
|
+
puts h.header5
|
100
|
+
puts h.header6
|
101
|
+
EOT
|
102
|
+
puts gen.fenced_code_language('ruby', *header_code.lines)
|
103
|
+
puts ""
|
104
|
+
puts "Results in this generated markdown ..."
|
105
|
+
header_markdown = capture_stdout do
|
106
|
+
eval(header_code)
|
107
|
+
end
|
108
|
+
puts gen.fenced_code_block(*header_markdown.string.lines)
|
109
|
+
puts "\nUltimately looking something like this (if your are viewing this on github or through some other markdown viewing method) ...\n\n"
|
110
|
+
puts eval(header_code)
|
94
111
|
puts ""
|
95
112
|
puts "Bulleted List Example".header3
|
96
113
|
list_content = ['gold', 'silver', 'bronze']
|
@@ -160,9 +177,9 @@ table_code = <<-EOT
|
|
160
177
|
puts gen.table_row("Second", "BC", "$14.00")
|
161
178
|
puts gen.table_row("Third", "DEFGH", "$1,034.50")
|
162
179
|
EOT
|
163
|
-
puts gen.
|
180
|
+
puts gen.fenced_code_language('ruby', *table_code.lines)
|
164
181
|
puts ""
|
165
|
-
puts "Produces this terribly ugly markdown ..."
|
182
|
+
puts "Produces this terribly ugly markdown (but standby, there is a better way below) ..."
|
166
183
|
puts ""
|
167
184
|
table_markdown = capture_stdout do
|
168
185
|
eval(table_code)
|
@@ -233,3 +250,23 @@ puts "rake readme".code
|
|
233
250
|
puts ""
|
234
251
|
puts "I'm calling this Extreme #{gen.link("Readme Driven Development", "http://tom.preston-werner.com/2010/08/23/readme-driven-development.html")}."
|
235
252
|
puts "It's kind of like #{gen.link("Inception", "http://en.wikipedia.org/wiki/Inception")} ;)"
|
253
|
+
puts ""
|
254
|
+
puts "Supported Ruby Versions".header2
|
255
|
+
puts ""
|
256
|
+
puts "The following ruby versions are explicitly supported (see .travis.yml)"
|
257
|
+
puts ""
|
258
|
+
puts gen.bullets("2.3.0", "2.2.4", "1.9.3", "ruby-head")
|
259
|
+
puts ""
|
260
|
+
puts "Release Process".header2
|
261
|
+
puts ""
|
262
|
+
puts "Document release changes in `CHANGELOG.md`"
|
263
|
+
puts ""
|
264
|
+
puts "Increment the VERSION number in `lib/mark_maker/version.rb`"
|
265
|
+
puts ""
|
266
|
+
puts "Run `rake release` which will:"
|
267
|
+
puts ""
|
268
|
+
puts gen.bullets("build the gem into the `pkg/` director",
|
269
|
+
"create a git tag for the version",
|
270
|
+
"push to github",
|
271
|
+
"push the packaged gem to rubygems")
|
272
|
+
|
data/lib/mark_maker/generator.rb
CHANGED
data/lib/mark_maker/version.rb
CHANGED
data/lib/mark_maker_string.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'mark_maker'
|
2
1
|
|
3
2
|
# adds several basic string to markdown conversion methods
|
4
3
|
class String
|
@@ -18,6 +17,18 @@ class String
|
|
18
17
|
"### #{self}"
|
19
18
|
end
|
20
19
|
|
20
|
+
def header4
|
21
|
+
"#### #{self}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def header5
|
25
|
+
"##### #{self}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def header6
|
29
|
+
"###### #{self}"
|
30
|
+
end
|
31
|
+
|
21
32
|
def bullet
|
22
33
|
" - #{self}"
|
23
34
|
end
|
data/mark_maker.gemspec
CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_development_dependency "bundler", "
|
23
|
-
spec.add_development_dependency "rake", "
|
22
|
+
spec.add_development_dependency "bundler", ">= 2"
|
23
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
24
24
|
spec.add_development_dependency "minitest"
|
25
25
|
spec.add_development_dependency "pry"
|
26
26
|
spec.add_development_dependency "unindent"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
|
4
|
+
require 'minitest_helper'
|
5
|
+
|
6
|
+
class TestHeaders < Minitest::Test
|
7
|
+
def test_header1_generation
|
8
|
+
title = "abc123"
|
9
|
+
markup = title.header1
|
10
|
+
assert_match(/^={#{title.size}}$/, markup)
|
11
|
+
assert_match(/^#{title}$/, markup)
|
12
|
+
assert_match(/^#{title}\n={#{title.size}}$/, markup)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_header2_generation
|
16
|
+
title = "abc123"
|
17
|
+
markup = title.header2
|
18
|
+
assert_match(/^-{#{title.size}}$/, markup)
|
19
|
+
assert_match(/^#{title}$/, markup)
|
20
|
+
assert_match(/^#{title}\n-{#{title.size}}$/, markup)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_header3_generation
|
24
|
+
title = "abc123"
|
25
|
+
markup = title.header3
|
26
|
+
assert_match(/###\s#{title}/, markup)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_header4_generation
|
30
|
+
title = "abc123"
|
31
|
+
markup = title.header4
|
32
|
+
assert_match(/####\s#{title}/, markup)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_header5_generation
|
36
|
+
title = "abc123"
|
37
|
+
markup = title.header5
|
38
|
+
assert_match(/#####\s#{title}/, markup)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_header6_generation
|
42
|
+
title = "abc123"
|
43
|
+
markup = title.header6
|
44
|
+
assert_match(/######\s#{title}/, markup)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/test/test_mark_maker.rb
CHANGED
@@ -43,7 +43,7 @@ class TestMarkMaker < Minitest::Test
|
|
43
43
|
title = "Build Status"
|
44
44
|
gen = MarkMaker::Generator.new
|
45
45
|
markup = gen.image(alt, path, title)
|
46
|
-
assert_match(/^!\[#{Regexp.quote(alt)}\]\(#{Regexp.quote(path)}\s#{Regexp.quote(title)}\)/, markup)
|
46
|
+
assert_match(/^!\[#{Regexp.quote(alt)}\]\(#{Regexp.quote(path)}\s"#{Regexp.quote(title)}"\)/, markup)
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_code_block_generation
|
@@ -4,28 +4,6 @@ SimpleCov.start
|
|
4
4
|
require 'minitest_helper'
|
5
5
|
|
6
6
|
class TestMarkMakerString < Minitest::Test
|
7
|
-
def test_header1_generation
|
8
|
-
title = "abc123"
|
9
|
-
markup = title.header1
|
10
|
-
assert_match(/^={#{title.size}}$/, markup)
|
11
|
-
assert_match(/^#{title}$/, markup)
|
12
|
-
assert_match(/^#{title}\n={#{title.size}}$/, markup)
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_header2_generation
|
16
|
-
title = "abc123"
|
17
|
-
markup = title.header2
|
18
|
-
assert_match(/^-{#{title.size}}$/, markup)
|
19
|
-
assert_match(/^#{title}$/, markup)
|
20
|
-
assert_match(/^#{title}\n-{#{title.size}}$/, markup)
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_header3_generation
|
24
|
-
title = "abc123"
|
25
|
-
markup = title.header3
|
26
|
-
assert_match(/###\s#{title}/, markup)
|
27
|
-
end
|
28
|
-
|
29
7
|
def test_bullet_generation
|
30
8
|
content = "This is a bullet"
|
31
9
|
markup = content.bullet
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mark_maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Schneider
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/mark_maker_string.rb
|
139
139
|
- mark_maker.gemspec
|
140
140
|
- test/minitest_helper.rb
|
141
|
+
- test/test_headers.rb
|
141
142
|
- test/test_mark_maker.rb
|
142
143
|
- test/test_mark_maker_string.rb
|
143
144
|
homepage: ''
|
@@ -159,12 +160,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
160
|
- !ruby/object:Gem::Version
|
160
161
|
version: '0'
|
161
162
|
requirements: []
|
162
|
-
|
163
|
-
rubygems_version: 2.5.1
|
163
|
+
rubygems_version: 3.0.6
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: Markdown generator.
|
167
167
|
test_files:
|
168
168
|
- test/minitest_helper.rb
|
169
|
+
- test/test_headers.rb
|
169
170
|
- test/test_mark_maker.rb
|
170
171
|
- test/test_mark_maker_string.rb
|