qiita-markdown 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.

Potentially problematic release.


This version of qiita-markdown might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48dcd3a415c694cd2793884f2b1fff63a05a291c
4
- data.tar.gz: 03ef10b80d3fff879e4fe499dc0f1e487edf0735
3
+ metadata.gz: 400a8d14ddb12519af903529d33edc4fde64b896
4
+ data.tar.gz: 9dc0960652c433e62e7b7f5b760905b13becc82a
5
5
  SHA512:
6
- metadata.gz: 35ffe04259cc89c0c2c0980f5bc7531fc7d7d9362bfd004b31cb1d9b920703f99e03315a5093f6af63465570c7546782ed6b8557476159d437710aa082dd57e4
7
- data.tar.gz: 2b4f1b18fd5f068f4f3c309e1afa998168459ad65ee171a3d1a8d414dcc96ddd29f628d11c00ac65f4f3118cee1200834cfde864d34c3d40e2d736b2ab6a2350
6
+ metadata.gz: b948ada8128ad2cbd8aa59018b651a4f48839ab385f62d86da5d1b8acf27141178cbcd40f2831c269d3b1c00d240f4740c03ff769ed49746306483a71d935a1e
7
+ data.tar.gz: a51d471e58496f7c593ab59fd90add803991b7dffe834b59b66893f1edc3bf81984a1e8b4bb85dd9cb9a2a317c9865f316c9e28c39c97ecb5966f4a86f5aa6e5
data/.rubocop_todo.yml CHANGED
@@ -22,7 +22,7 @@ Metrics/LineLength:
22
22
  # Offense count: 3
23
23
  # Configuration parameters: CountComments.
24
24
  Metrics/MethodLength:
25
- Max: 17
25
+ Max: 20
26
26
 
27
27
  # Offense count: 1
28
28
  # Cop supports --auto-correct.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
+ ## 0.7.0
2
+ - Support `@all`
3
+
1
4
  ## 0.6.0
2
- * Add `:escape_html` extension to Qiita::Markdown::Greenmat::HTMLToCRenderer.
3
- * Fix backward incompatibility of fragment identifier of heading that includes special HTML characters in v0.5.0.
5
+ - Add `:escape_html` extension to Qiita::Markdown::Greenmat::HTMLToCRenderer.
6
+ - Fix backward incompatibility of fragment identifier of heading that includes special HTML characters in v0.5.0.
4
7
 
5
8
  ## 0.5.0
6
9
  - Add renderers Qiita::Markdown::Greenmat::HTMLRenderer and Qiita::Markdown::Greenmat::HTMLToCRenderer which can be passed to `Redcarpet::Markdown.new` and generate consistent heading fragment identifiers.
@@ -22,7 +22,14 @@ module Qiita
22
22
  def mention_link_filter(text, _, _)
23
23
  text.gsub(MentionPattern) do |match|
24
24
  name = $1
25
- if allowed_usernames && !allowed_usernames.include?(name)
25
+ case
26
+ when allowed_usernames && name == "all"
27
+ result[:mentioned_usernames] |= allowed_usernames
28
+ match.sub(
29
+ "@#{name}",
30
+ %[<a href="/" class="user-mention" title="#{name}">@#{name}</a>]
31
+ )
32
+ when allowed_usernames && !allowed_usernames.include?(name) || name == "all"
26
33
  match
27
34
  else
28
35
  result[:mentioned_usernames] |= [name]
@@ -1,5 +1,5 @@
1
1
  module Qiita
2
2
  module Markdown
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
@@ -324,6 +324,48 @@ describe Qiita::Markdown::Processor do
324
324
  end
325
325
  end
326
326
 
327
+ context "with @all and allowed_usernames context" do
328
+ before do
329
+ context[:allowed_usernames] = ["alice", "bob"]
330
+ end
331
+
332
+ let(:markdown) do
333
+ "@all"
334
+ end
335
+
336
+ it "links it and reports all allowed users as mentioned user names" do
337
+ should include(<<-EOS.strip_heredoc.rstrip)
338
+ <a href="/" class="user-mention" title="all">@all</a>
339
+ EOS
340
+ expect(result[:mentioned_usernames]).to eq context[:allowed_usernames]
341
+ end
342
+ end
343
+
344
+ context "with @all and @alice" do
345
+ before do
346
+ context[:allowed_usernames] = ["alice", "bob"]
347
+ end
348
+
349
+ let(:markdown) do
350
+ "@all @alice"
351
+ end
352
+
353
+ it "does not duplicate mentioned user names" do
354
+ expect(result[:mentioned_usernames]).to eq context[:allowed_usernames]
355
+ end
356
+ end
357
+
358
+ context "with @all and no allowed_usernames context" do
359
+ let(:markdown) do
360
+ "@all"
361
+ end
362
+
363
+ it "does not repond to @all" do
364
+ should eq "<p>@all</p>\n"
365
+ expect(result[:mentioned_usernames]).to eq []
366
+ end
367
+ end
368
+
327
369
  context "with normal link" do
328
370
  let(:markdown) do
329
371
  "[](/example)"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiita-markdown
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
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -303,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  version: '0'
304
304
  requirements: []
305
305
  rubyforge_project:
306
- rubygems_version: 2.4.6
306
+ rubygems_version: 2.4.5
307
307
  signing_key:
308
308
  specification_version: 4
309
309
  summary: Qiita-specified markdown processor.
@@ -313,4 +313,3 @@ test_files:
313
313
  - spec/qiita/markdown/processor_spec.rb
314
314
  - spec/qiita/markdown/summary_processor_spec.rb
315
315
  - spec/spec_helper.rb
316
- has_rdoc: