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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 142542ba7114af62f17ff07bce33fed666fb13f4
4
- data.tar.gz: 65302ae5e6b40ab47424c74952c3150819e492ef
3
+ metadata.gz: 4c7fac396db1618afdef3733cb97481153162700
4
+ data.tar.gz: 35d7bbbd980875e2fc5d1feb9f54fc4772e020d4
5
5
  SHA512:
6
- metadata.gz: 9a3daed5e8da337a5aeea8d3a685031ea6917c0dac163b1a4ac81567a0c1bf5fac2728a2c1bf004d3b44e550bf12fdedf3116ee41c89ed086696ac20d498834b
7
- data.tar.gz: 36b9ccec884afa53fa692e6d8c3c87b6f30dd88ca900e28a77c51d35b2c72d00c28025d7f6b70b16c1a7d8defe03ad2b3e0d4e455d92b6e492cf3ce1caeda0fb
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
- ::HTMLEntities.new.decode( kramdown.to_html )
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
- Kramdown::Document.new(preprocess(source))
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)
@@ -1,5 +1,5 @@
1
1
  # $~callout, ~$
2
2
 
3
3
  <div class='callout'>
4
- <%= Mastalk::Document.new(body.strip).to_html %>
4
+ <%= Mastalk::Document.new(body.strip).to_html(:auto_id => false) %>
5
5
  </div>
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.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
- "<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"
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.6.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-08-03 00:00:00.000000000 Z
12
+ date: 2016-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: kramdown