qiita-markdown 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of qiita-markdown might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +5 -2
- data/lib/qiita/markdown/filters/mention.rb +8 -1
- data/lib/qiita/markdown/version.rb +1 -1
- data/spec/qiita/markdown/processor_spec.rb +42 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 400a8d14ddb12519af903529d33edc4fde64b896
|
4
|
+
data.tar.gz: 9dc0960652c433e62e7b7f5b760905b13becc82a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b948ada8128ad2cbd8aa59018b651a4f48839ab385f62d86da5d1b8acf27141178cbcd40f2831c269d3b1c00d240f4740c03ff769ed49746306483a71d935a1e
|
7
|
+
data.tar.gz: a51d471e58496f7c593ab59fd90add803991b7dffe834b59b66893f1edc3bf81984a1e8b4bb85dd9cb9a2a317c9865f316c9e28c39c97ecb5966f4a86f5aa6e5
|
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
## 0.7.0
|
2
|
+
- Support `@all`
|
3
|
+
|
1
4
|
## 0.6.0
|
2
|
-
|
3
|
-
|
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
|
-
|
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]
|
@@ -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.
|
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-
|
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.
|
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:
|