little fix

This commit is contained in:
alsotang 2014-10-11 22:13:35 +08:00
parent 78990e45e1
commit d048e4e347
2 changed files with 22 additions and 22 deletions

View File

@ -24,7 +24,7 @@ var fetchUsers = function (text) {
/```[\s\S]+?```/g, // ``` 里面的是 pre 标签内容
/`[\s\S]+?`/g, // 同一行中,`some code` 中内容也不该被解析
/^ .*/gm, // 4个空格也是 pre 标签,在这里 . 不会匹配换行
/@[^\s]*?\..+?/g, // somebody@gmail.com 会被去除
/@[^\s]*?\..+?\b/g, // somebody@gmail.com 会被去除
];
ignore_regexs.forEach(function(ignore_regex) {

View File

@ -34,7 +34,7 @@ describe('test/common/at.test.js', function () {
Text 中文@begin_with_no_spaces
@end_with_no_space@begin_with_no_spaces
jysperm@gmail.com
jysperm@gmail.com @alsotang
@
@@
@ -52,36 +52,36 @@ describe('test/common/at.test.js', function () {
```
*/});
var matched_users = ['A-aZ-z0-9_', 'begin_with_spaces', 'multi_in_oneline', 'around_text', 'end_with_no_space', 'begin_with_no_spaces', 'end_with_no_space', 'begin_with_no_spaces'];
var matched_users = ['A-aZ-z0-9_', 'begin_with_spaces', 'multi_in_oneline', 'around_text', 'end_with_no_space', 'begin_with_no_spaces', 'end_with_no_space', 'begin_with_no_spaces', 'alsotang'];
var linkedText = multiline.stripIndent(function(){/*
[@A-aZ-z0-9_](/user/A-aZ-z0-9_)
@中文
[@begin_with_spaces](/user/begin_with_spaces) [@multi_in_oneline](/user/multi_in_oneline)
Text More Text [@around_text](/user/around_text) ![Pic](/public/images/cnode_icon_32.png)
[@end_with_no_space](/user/end_with_no_space)
Text 中文@begin_with_no_spaces
[@end_with_no_space](/user/end_with_no_space)@begin_with_no_spaces
[@A-aZ-z0-9_](/user/A-aZ-z0-9_)
@中文
[@begin_with_spaces](/user/begin_with_spaces) [@multi_in_oneline](/user/multi_in_oneline)
Text More Text [@around_text](/user/around_text) ![Pic](/public/images/cnode_icon_32.png)
[@end_with_no_space](/user/end_with_no_space)
Text 中文[@begin_with_no_spaces](/user/begin_with_no_spaces)
[@end_with_no_space](/user/end_with_no_space)[@begin_with_no_spaces](/user/begin_with_no_spaces)
jysperm@gmail.com
jysperm@gmail.com [@alsotang](/user/alsotang)
@
@@
@
@@
`@code_begin_with_no_space`
code: `@in_code`
`@code_begin_with_no_space`
code: `@in_code`
@in_pre
@in_pre
``` @in_oneline_pre ```
``` @in_oneline_pre ```
```
Some Code
Code @in_multi_line_pre
```
```
Some Code
Code @in_multi_line_pre
```
*/});
describe.only('#fetchUsers()', function () {
describe('#fetchUsers()', function () {
var fetchUsers = at.fetchUsers;
it('should found 6 users', function () {
var users = fetchUsers(text);