mastalk 0.6.0 → 0.7.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/lib/mastalk.rb +6 -4
- data/lib/mastalk/snippets/callout.html.erb +1 -1
- data/mastalk.gemspec +1 -1
- data/spec/mastalk_spec.rb +6 -2
- 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: 4c7fac396db1618afdef3733cb97481153162700
|
4
|
+
data.tar.gz: 35d7bbbd980875e2fc5d1feb9f54fc4772e020d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93953d6fc69652aa456a64ea9c75d44630960b5e3c7908cf431f93b86ca9d6f02c2467e46f8a087c3cee754acc879a97917b0683c57bb20c2a92082639768960
|
7
|
+
data.tar.gz: 1df6c53c87d0bd576abd044757bd5688fe416a76b9ad49b21cad84cf005e405500075491bef93058f2a4afc4847f3e94a4c354595c69e3fad6fb85151d9646eb
|
data/lib/mastalk.rb
CHANGED
@@ -14,14 +14,16 @@ module Mastalk
|
|
14
14
|
@source = source.dup
|
15
15
|
end
|
16
16
|
|
17
|
-
def to_html
|
18
|
-
|
17
|
+
def to_html(options = {})
|
18
|
+
options[:auto_id] = options[:auto_id].nil? ? true : options[:auto_id]
|
19
|
+
::HTMLEntities.new.decode( kramdown(options).to_html() )
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
|
-
def kramdown
|
24
|
-
|
24
|
+
def kramdown(options = {})
|
25
|
+
options[:auto_id] = options[:auto_id].nil? ? true : options[:auto_id]
|
26
|
+
Kramdown::Document.new(preprocess(source), :auto_ids => options[:auto_id])
|
25
27
|
end
|
26
28
|
|
27
29
|
def preprocess(source)
|
data/mastalk.gemspec
CHANGED
@@ -3,7 +3,7 @@ $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.
|
6
|
+
s.version = '0.7.0'
|
7
7
|
s.summary = 'mastalk'
|
8
8
|
s.description = 'Mastalk markdown extension language'
|
9
9
|
s.authors = ['Douglas Roper', 'Justin Perry']
|
data/spec/mastalk_spec.rb
CHANGED
@@ -12,6 +12,10 @@ describe Mastalk::Document do
|
|
12
12
|
expect(Mastalk::Document.new('test').to_html).to eq("<p>test</p>\n")
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'generates automatic ID attributes on headings' do
|
16
|
+
expect(Mastalk::Document.new('##test').to_html).to eq(%Q(<h2 id="test">test</h2>\n))
|
17
|
+
end
|
18
|
+
|
15
19
|
it 'converts to html' do
|
16
20
|
expect(subject.to_html).to eq(expected)
|
17
21
|
end
|
@@ -98,10 +102,10 @@ describe Mastalk::Document do
|
|
98
102
|
let(:source) { "$~callout\n ##yes ~$ $~callout\n ##yes ~$" }
|
99
103
|
|
100
104
|
let(:expected) do
|
101
|
-
|
105
|
+
%Q(<div class="callout">\n <h2>yes</h2>\n\n</div>\n<div class="callout">\n <h2>yes</h2>\n\n</div>\n)
|
102
106
|
end
|
103
107
|
|
104
|
-
it 'pre-processes correctly' do
|
108
|
+
it 'pre-processes correctly, without adding ids to headings' do
|
105
109
|
expect(subject.to_html).to eq(expected)
|
106
110
|
end
|
107
111
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mastalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Roper
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: kramdown
|