sixarm_ruby_markdown 3.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1396bf0f73d5f0a9db06e516d932d5b7b012ae69703e5c5570925673e9bbdfe7
4
- data.tar.gz: 161f643bd18aa3af8a67137fb567dbb31097148274ab60f2270255df8fa9e381
3
+ metadata.gz: 3a4a0f2523878c816f7a5f2ff42a0e3806688f16c5e0c08b9916f4ada1fa34f3
4
+ data.tar.gz: d2ac49330540e15a669037ba828ba972361f725da4082186c4da10721f018b06
5
5
  SHA512:
6
- metadata.gz: a49446d6b98fddd1e66966c3af7bca6135408c32f0b27974eb08783ab3935bed6d0703ed3b16e05bd368dc470e5905eacf2d618dc778b26df4eb516d9ea667cc
7
- data.tar.gz: 699b28e84fe9a7a2c83e3af4e6a40894cf788a30fef0b6026b4b6091779961ebeb65b4e3605e14a734faf592cf35bd30382b90bbaf74da4a14922011c67d42eb
6
+ metadata.gz: 3f961a438f65d6a4dbcffb5ff3e8deb52ea9ce28513f0d1caa0e082fd4094b05ca5389e35775ca815a7713b0c36564f6df1aaaa88e07acad03b2aa4e70b559a1
7
+ data.tar.gz: 4cac8249dbb7423ace8f012b5837f4d91da0d6378ab6aa63ddcb3e41260d722736dda23f0c8a2a08ed26e837c2be99625b3da8f9104af8588ed0b97d8c229c38
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -55,7 +55,7 @@ class SixArm::Markdown::Headline
55
55
  end
56
56
 
57
57
  def self.text_to_anchor(text)
58
- text.downcase.gsub(/\W+/,'-')
58
+ text.downcase.gsub(/\W+/,'-').gsub(/^-+|-+$/,'')
59
59
  end
60
60
 
61
61
  end
@@ -11,6 +11,7 @@ describe SixArm::Markdown::Headline do
11
11
  let(:link_default){ "[Foo Goo Hoo](#foo-goo-hoo)" }
12
12
  let(:link_custom){ "[My Link Text](#my-link-anchor)" }
13
13
  let(:headline){ SixArm::Markdown::Headline.new(text: text) }
14
+ let(:some_atypical_characters){ "!@#$%^&*(){}[]|;':<>,.?/" }
14
15
 
15
16
  describe "#text" do
16
17
 
@@ -30,11 +31,20 @@ describe SixArm::Markdown::Headline do
30
31
  end
31
32
 
32
33
  end
34
+
35
+ describe "with text with with atypical characters, which will be excised in the anchor" do
36
+
37
+ it "return default anchor" do
38
+ headline = SixArm::Markdown::Headline.new(text: some_atypical_characters + text + some_atypical_characters)
39
+ expect(headline.anchor).must_equal anchor_default
40
+ end
41
+
42
+ end
33
43
 
34
44
  describe "with custom anchor" do
35
45
 
36
46
  it "return custom anchor" do
37
- headline = SixArm::Markdown::Headline.new(text: text, anchor: anchor_custom)
47
+ headline = SixArm::Markdown::Headline.new(text: text, anchor: anchor_custom)
38
48
  expect(headline.anchor).must_equal anchor_custom
39
49
  end
40
50
 
@@ -69,11 +79,23 @@ describe SixArm::Markdown::Headline do
69
79
  describe "with default, which is no link, thus uses autogeneration" do
70
80
 
71
81
  it "return default link, which is the Markdown formatting of the text and anchor" do
82
+ headline = SixArm::Markdown::Headline.new(text: text)
72
83
  expect(headline.link).must_equal link_default
73
84
  end
74
85
 
75
86
  end
76
87
 
88
+ describe "with text with atypical characters, which will be excised in the link" do
89
+
90
+ it "return default link, which is the Markdown formatting of the text and anchor" do
91
+ text_atypical = some_atypical_characters + text + some_atypical_characters
92
+ link_atypical = "[#{text_atypical}](\##{anchor_default})"
93
+ headline = SixArm::Markdown::Headline.new(text: text_atypical)
94
+ expect(headline.link).must_equal link_atypical
95
+ end
96
+
97
+ end
98
+
77
99
  describe "with custom link" do
78
100
 
79
101
  it "return custom link" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixarm_ruby_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SixArm
@@ -39,7 +39,7 @@ cert_chain:
39
39
  tzpk/VnZXj7Ek/earx+N/Z+Wtnl2xENm5IF8SFPeI1HFa9NH47pqtxF1YKpNIEVc
40
40
  2xa2BNHSePe7tys/2hbmZuyMu8X5ERmovsabSXB3a+YwtJh5c2jhA21wF7986s0q
41
41
  -----END CERTIFICATE-----
42
- date: 2018-09-23 00:00:00.000000000 Z
42
+ date: 2018-12-23 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: sixarm_ruby_equal_instance_variables
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  version: '0'
288
288
  requirements: []
289
289
  rubyforge_project:
290
- rubygems_version: 2.7.7
290
+ rubygems_version: 2.7.8
291
291
  signing_key:
292
292
  specification_version: 4
293
293
  summary: SixArm.com → Ruby → Markdown
metadata.gz.sig CHANGED
Binary file