mastalk 0.1.2 → 0.2.0
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/README.md +2 -2
- data/lib/mastalk/extensions.rb +1 -1
- data/lib/mastalk/snippets/action_item.html.erb +1 -1
- data/lib/mastalk/snippets/add_action.html.erb +1 -1
- data/lib/mastalk/snippets/callout.html.erb +1 -1
- data/lib/mastalk/snippets/collapsable.html.erb +1 -1
- data/lib/mastalk/snippets/collapsible_header.html.erb +1 -1
- data/lib/mastalk/snippets/ticks.html.erb +1 -1
- data/lib/mastalk.rb +2 -1
- data/mastalk.gemspec +2 -2
- data/spec/mastalk_spec.rb +25 -1
- 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: 20d1aaef80c7e2a2b51c613eee6e0df5ab6fbe9c
|
4
|
+
data.tar.gz: 1c3ea4b6799681f990a1ae55bd1f2440e982057c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2413d958bdfbfb7d8420c06b62496ca2b0b381ab9b1f0fc185bf88c3786310b50c1fbe7d792689d5ed20ceee303fa2fc63048b9d6559b222fc346f0747cb248d
|
7
|
+
data.tar.gz: 29371f00356396cf9d4ac9d02241460ce3274cbd519d7ce4c68880abd644b9661a35bea0129c010fc8390286672d5279970a03e6c8cf27c14c3d9dc451d9f00c
|
data/README.md
CHANGED
@@ -35,11 +35,11 @@ Outputs:
|
|
35
35
|
`.callout`
|
36
36
|
|
37
37
|
```
|
38
|
-
|
38
|
+
$~callout
|
39
39
|
# Budgeting tips
|
40
40
|
In 1985, average first-time buyers needed a deposit of 5% to buy a home - in 2012, this had increased to 20%
|
41
41
|
*Source: HMS Treasury*
|
42
|
-
|
42
|
+
~$
|
43
43
|
```
|
44
44
|
|
45
45
|
Outputs:
|
data/lib/mastalk/extensions.rb
CHANGED
@@ -15,7 +15,7 @@ module Mastalk
|
|
15
15
|
def extension(start, stop = nil, new_line = false, &block)
|
16
16
|
re_start = Regexp.escape(start)
|
17
17
|
re_stop = stop == '$' ? stop : Regexp.escape(stop || start)
|
18
|
-
regex = Regexp.new("#{re_start}(
|
18
|
+
regex = Regexp.new("#{re_start}(.*?)(#{re_stop}+)", new_line ? 0 : Regexp::MULTILINE)
|
19
19
|
@@extensions << [regex, block]
|
20
20
|
end
|
21
21
|
|
data/lib/mastalk.rb
CHANGED
@@ -26,9 +26,10 @@ module Mastalk
|
|
26
26
|
def preprocess(source)
|
27
27
|
extensions.map do |regex, block|
|
28
28
|
if source.match(regex)
|
29
|
-
source.
|
29
|
+
source.sub!(regex, block.call(Regexp.last_match.captures.first))
|
30
30
|
end
|
31
31
|
end
|
32
|
+
preprocess(source) if extensions.any? {|regex, _| source.match(regex)}
|
32
33
|
source
|
33
34
|
end
|
34
35
|
end
|
data/mastalk.gemspec
CHANGED
@@ -3,8 +3,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'mastalk'
|
6
|
-
s.version = '0.
|
7
|
-
s.date = '2014-
|
6
|
+
s.version = '0.2.0'
|
7
|
+
s.date = '2014-11-11'
|
8
8
|
s.summary = 'mastalk'
|
9
9
|
s.description = 'Mastalk markdown extension language'
|
10
10
|
s.authors = ['Douglas Roper']
|
data/spec/mastalk_spec.rb
CHANGED
@@ -73,7 +73,7 @@ describe Mastalk::Document do
|
|
73
73
|
let(:source) { "$yes-no\n [y] yes \n [n] no \n $end $why\n###header\nbody\n$why" }
|
74
74
|
|
75
75
|
let(:expected) do
|
76
|
-
"<ul class=\"yes-no\">\n \n<li class=\"yes\">yes</li>\n\n<li class=\"no\">no</li>\n\n\n</ul>\n<div class=\"why\">
|
76
|
+
"<ul class=\"yes-no\">\n \n <li class=\"yes\">yes</li>\n\n <li class=\"no\">no</li>\n\n \n</ul>\n<div class=\"why\">
|
77
77
|
<h3 id=\"header\">header</h3>\n<p>body</p>\n\n</div>\n"
|
78
78
|
end
|
79
79
|
|
@@ -81,4 +81,28 @@ describe Mastalk::Document do
|
|
81
81
|
expect(subject.to_html).to eq(expected)
|
82
82
|
end
|
83
83
|
end
|
84
|
+
|
85
|
+
context 'two matches after each other' do
|
86
|
+
let(:source) { "$yes-no\n [y] yes \n $end $yes-no\ [n] no \n $end" }
|
87
|
+
|
88
|
+
let(:expected) do
|
89
|
+
"<ul class=\"yes-no\">\n \n <li class=\"yes\">yes</li>\n\n \n</ul>\n<ul class=\"yes-no\">\n <li class=\"no\">no</li>\n\n \n</ul>\n"
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'pre-processes correctly' do
|
93
|
+
expect(subject.to_html).to eq(expected)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'two callouts after each other' do
|
98
|
+
let(:source) { "$~callout\n ##yes ~$ $~callout\n ##yes ~$" }
|
99
|
+
|
100
|
+
let(:expected) do
|
101
|
+
"<div class=\"callout\">\n <h2 id=\"yes\">yes</h2>\n\n</div>\n<div class=\"callout\">\n <h2 id=\"yes\">yes</h2>\n\n</div>\n"
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'pre-processes correctly' do
|
105
|
+
expect(subject.to_html).to eq(expected)
|
106
|
+
end
|
107
|
+
end
|
84
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mastalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Roper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|