mark_maker 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -4
- data/bin/generate_readme.rb +21 -6
- data/lib/mark_maker/generator.rb +16 -2
- data/lib/mark_maker/version.rb +1 -1
- data/test/test_mark_maker.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69e37903d222999dbd87778a55fb41e841054995
|
4
|
+
data.tar.gz: 5899b79c8427151ed0bb4979546d679a8191e1dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 560761348ac0f5da4fd4442f070eb57ceed38906b5911a35aaa016c85a572d7abcfbfbefa47bc64ec9fb903b6f7d924916941c1ad498f7c4ad13d90b1db91d1f
|
7
|
+
data.tar.gz: aff10b5f78ba18af4f401506445027bbab02ab3c704ad5096a417c32488c959ffa679b93d98bf5f440170873d61f22275d3ab479492c3b71f87eb65e2f1c375e
|
data/README.md
CHANGED
@@ -35,14 +35,33 @@ Produces
|
|
35
35
|
Let It Begin
|
36
36
|
============
|
37
37
|
|
38
|
+
### Bulleted List Example
|
39
|
+
|
40
|
+
list_content = ['gold', 'silver', 'bronze']
|
41
|
+
gen.bullets(*list_content)
|
42
|
+
|
43
|
+
Produces
|
44
|
+
|
45
|
+
- gold
|
46
|
+
- silver
|
47
|
+
- bronze
|
48
|
+
|
49
|
+
Or a numbered list with...
|
50
|
+
|
51
|
+
gen.numbers(*list_content)
|
52
|
+
|
53
|
+
1. gold
|
54
|
+
2. silver
|
55
|
+
3. bronze
|
56
|
+
|
38
57
|
Contributing
|
39
58
|
------------
|
40
59
|
|
41
60
|
1. [Fork it](https://github.com/sn1de/mark_maker/fork)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
61
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
62
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
63
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
64
|
+
5. Create a new Pull Request
|
46
65
|
|
47
66
|
About This README
|
48
67
|
-----------------
|
data/bin/generate_readme.rb
CHANGED
@@ -54,13 +54,28 @@ doc << gen.code("gen.header1('#{example_header}'')")
|
|
54
54
|
doc << "\nProduces\n\n"
|
55
55
|
gen.header1(example_header).lines.map { |l| doc << gen.code(l) }
|
56
56
|
doc << ""
|
57
|
+
doc << gen.header3("Bulleted List Example")
|
58
|
+
list_content = ['gold', 'silver', 'bronze']
|
59
|
+
doc << ""
|
60
|
+
doc << gen.code("list_content = ['gold', 'silver', 'bronze']")
|
61
|
+
doc << gen.code("gen.bullets(*list_content)")
|
62
|
+
doc << "\nProduces\n\n"
|
63
|
+
doc << gen.bullets(*list_content)
|
64
|
+
doc << ""
|
65
|
+
doc << "Or a numbered list with..."
|
66
|
+
doc << ""
|
67
|
+
numbered_code = "gen.numbers(*list_content)"
|
68
|
+
doc << gen.code(numbered_code)
|
69
|
+
doc << ""
|
70
|
+
doc << eval(numbered_code)
|
71
|
+
doc << ""
|
57
72
|
doc << gen.header2("Contributing")
|
58
73
|
doc << ""
|
59
|
-
doc << gen.
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
74
|
+
doc << gen.numbers(gen.link("Fork it", "https://github.com/sn1de/mark_maker/fork"),
|
75
|
+
"Create your feature branch (`git checkout -b my-new-feature`)",
|
76
|
+
"Commit your changes (`git commit -am 'Add some feature'`)",
|
77
|
+
"Push to the branch (`git push origin my-new-feature`)",
|
78
|
+
"Create a new Pull Request")
|
64
79
|
doc << ""
|
65
80
|
doc << gen.header2("About This README")
|
66
81
|
doc << ""
|
@@ -73,4 +88,4 @@ doc << gen.code("rake readme")
|
|
73
88
|
doc << ""
|
74
89
|
doc << "I'm calling this Extreme #{gen.link("Readme Driven Development", "http://tom.preston-werner.com/2010/08/23/readme-driven-development.html")}."
|
75
90
|
doc << "It's kind of like #{gen.link("Inception", "http://en.wikipedia.org/wiki/Inception")} ;)"
|
76
|
-
puts doc
|
91
|
+
puts doc
|
data/lib/mark_maker/generator.rb
CHANGED
@@ -17,12 +17,26 @@ module MarkMaker
|
|
17
17
|
def header3(title)
|
18
18
|
"### #{title}"
|
19
19
|
end
|
20
|
+
|
20
21
|
def bullet(content)
|
21
22
|
" - #{content}"
|
22
23
|
end
|
23
24
|
|
24
|
-
def
|
25
|
-
|
25
|
+
def bullets(*content)
|
26
|
+
bullet_list = []
|
27
|
+
content.each { |li| bullet_list << bullet(li) }
|
28
|
+
bullet_list
|
29
|
+
end
|
30
|
+
|
31
|
+
def number(content, number = 1)
|
32
|
+
" #{number}. #{content}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def numbers(*content)
|
36
|
+
numbered_list = []
|
37
|
+
current_number = 0
|
38
|
+
content.each { |li| numbered_list << number(li, current_number += 1) }
|
39
|
+
numbered_list
|
26
40
|
end
|
27
41
|
|
28
42
|
def link(label, url)
|
data/lib/mark_maker/version.rb
CHANGED
data/test/test_mark_maker.rb
CHANGED
@@ -37,6 +37,15 @@ class TestMarkMaker < Minitest::Test
|
|
37
37
|
assert_match(/^ - #{content}$/, markup)
|
38
38
|
end
|
39
39
|
|
40
|
+
def test_bulleted_list_generation
|
41
|
+
content = ["gold", "silver", "bronze"]
|
42
|
+
gen = MarkMaker::Generator.new
|
43
|
+
markup = gen.bullets(*content)
|
44
|
+
assert(markup.length == content.length, "The number of lines of content and markup is not equal.")
|
45
|
+
content.zip(markup).each do |c, m|
|
46
|
+
assert_match(/^\s-\s#{c}$/, m)
|
47
|
+
end
|
48
|
+
end
|
40
49
|
def test_number_generation
|
41
50
|
content = "Number this line"
|
42
51
|
gen = MarkMaker::Generator.new
|
@@ -44,6 +53,16 @@ class TestMarkMaker < Minitest::Test
|
|
44
53
|
assert_match(/^\s\d\.\s#{content}$/, markup)
|
45
54
|
end
|
46
55
|
|
56
|
+
def test_numbered_list_generation
|
57
|
+
content = ["1", "2", "3"]
|
58
|
+
gen = MarkMaker::Generator.new
|
59
|
+
markup = gen.numbers(*content)
|
60
|
+
assert(markup.length == content.length, "The number of lines of content and markup is not equal.")
|
61
|
+
content.zip(markup).each do |c, m|
|
62
|
+
assert_match(/^\s#{c}\.\s#{c}$/, m)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
47
66
|
def test_link_generation
|
48
67
|
label = "anywhere"
|
49
68
|
url = "http://www.yahoo.com"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mark_maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Schneider
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|