dtext_rb 1.0.12 → 1.0.13

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: c6dc8726968b6ed437ba690472b77761d8d9d1e3
4
- data.tar.gz: e0ef0b7f8183e18ca1406f116796a5e59c35ac64
3
+ metadata.gz: 9821e7f5baf5116232cdf41d824b576e97e497dd
4
+ data.tar.gz: 3f9da0fcfb340e3edb2fddbefb67e116ef3b2357
5
5
  SHA512:
6
- metadata.gz: 2b4b8c8f1cbf0819209b63e338425d0fea927ead929396536f9f44b15ed90eecae9182eab32bef172dcb5fb2b0d7342cda7b66b598fe781f89a9340b415df18e
7
- data.tar.gz: 57807906d40b4f86ea8c57ea9fa61d039a45b6659e97ca69a7bc58314daa5a0cd2f552319fe49e6bb62c95c61396e8e93da54cc42d344cd9151d2975790404de
6
+ metadata.gz: 7cbb109618adcc8c1bd52d7a38009edc59c4dea62e8247f7f5186bd9aa01044f95488b9c6fef28d1253e4f9699ba8b21f2fe28aa1491e9b187c6114114fdfc86
7
+ data.tar.gz: 58fc6527a37ee34def27534a1ad2311e6366977fee897048d01beff1ec551e99df25ef8eee364cfe951ad36e26964f480626201d63b7f12536592f5b75d22a2c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.12
1
+ 1.0.13
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: dtext_rb 1.0.12 ruby lib
5
+ # stub: dtext_rb 1.0.13 ruby lib
6
6
  # stub: ext/dtext/extconf.rb
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "dtext_rb"
10
- s.version = "1.0.12"
10
+ s.version = "1.0.13"
11
11
 
12
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
13
  s.require_paths = ["lib"]
14
14
  s.authors = ["r888888888"]
15
- s.date = "2016-09-08"
15
+ s.date = "2016-09-23"
16
16
  s.description = "Compield DText parser"
17
17
  s.email = "r888888888@gmail.com"
18
18
  s.extensions = ["ext/dtext/extconf.rb"]
@@ -120,10 +120,16 @@ nonpipe = ^'|';
120
120
  nonpipebracket = nonpipe & nonbracket;
121
121
  noncurly = ^'}';
122
122
 
123
- mention = '@' graph+ >mark_a1 %mark_a2;
123
+ utf8graph = (0x00..0x7F) & graph
124
+ | 0xC2..0xDF 0x80..0xBF
125
+ | 0xE0..0xEF 0x80..0xBF 0x80..0xBF
126
+ | 0xF0..0xF4 0x80..0xBF 0x80..0xBF 0x80..0xBF;
124
127
 
125
- url = 'http' 's'? '://' graph+;
126
- internal_url = '/' graph+;
128
+
129
+ mention = '@' utf8graph+ >mark_a1 %mark_a2;
130
+
131
+ url = 'http' 's'? '://' utf8graph+;
132
+ internal_url = '/' utf8graph+;
127
133
  basic_textile_link = '"' nonquote+ >mark_a1 '"' >mark_a2 ':' (url | internal_url) >mark_b1 %mark_b2;
128
134
  bracketed_textile_link = '"' nonquote+ >mark_a1 '"' >mark_a2 ':[' (url | internal_url) >mark_b1 %mark_b2 :>> ']';
129
135
 
@@ -256,4 +256,16 @@ class DTextTest < Minitest::Test
256
256
  def test_old_asterisks
257
257
  assert_parse("<p>hello *world* neutral</p>", "hello *world* neutral")
258
258
  end
259
+
260
+ def test_utf8_mentions
261
+ assert_parse('<p><a rel="nofollow" href="/users?name=葉月">@葉月</a></p>', "@葉月")
262
+ assert_parse('<p>Hello <a rel="nofollow" href="/users?name=葉月">@葉月</a> and <a rel="nofollow" href="/users?name=Alice">@Alice</a></p>', "Hello @葉月 and @Alice")
263
+ assert_parse('<p>Should not parse 葉月@葉月</p>', "Should not parse 葉月@葉月")
264
+ end
265
+
266
+ def test_utf8_links
267
+ assert_parse('<p><a href="/posts?tags=approver:葉月">7893</a></p>', '"7893":/posts?tags=approver:葉月')
268
+ assert_parse('<p><a href="/posts?tags=approver:葉月">7893</a></p>', '"7893":[/posts?tags=approver:葉月]')
269
+ assert_parse('<p><a href="http://danbooru.donmai.us/posts?tags=approver:葉月">http://danbooru.donmai.us/posts?tags=approver:葉月</a></p>', 'http://danbooru.donmai.us/posts?tags=approver:葉月')
270
+ end
259
271
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtext_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - r888888888
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-08 00:00:00.000000000 Z
11
+ date: 2016-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest