diff --git a/common/at.js b/common/at.js index 71638a7..17dd5f4 100644 --- a/common/at.js +++ b/common/at.js @@ -21,7 +21,7 @@ var _ = require('lodash'); */ var fetchUsers = function (text) { var ignore_regexs = [ - /```.+?```/, // 去除单行的 ``` + /```.+?```/g, // 去除单行的 ``` /^```[\s\S]+?^```/gm, // ``` 里面的是 pre 标签内容 /`[\s\S]+?`/g, // 同一行中,`some code` 中内容也不该被解析 /^ .*/gm, // 4个空格也是 pre 标签,在这里 . 不会匹配换行 @@ -33,6 +33,7 @@ var fetchUsers = function (text) { text = text.replace(ignore_regex, ''); }); + var results = text.match(/@[a-z0-9\-_]+\b/igm); var names = []; if (results) { diff --git a/controllers/site.js b/controllers/site.js index fa7b4ef..78be1a1 100644 --- a/controllers/site.js +++ b/controllers/site.js @@ -19,6 +19,9 @@ var renderHelper = require('../common/render_helper'); // 主页的缓存工作。主页是需要主动缓存的 function indexCache() { + if (config.debug) { + return; + } var limit = config.list_topic_count; // 为所有版块(tab)做缓存 [['', '全部']].concat(config.tabs).forEach(function (pair) { diff --git a/test/common/at.test.js b/test/common/at.test.js index c9a5ae6..256a440 100644 --- a/test/common/at.test.js +++ b/test/common/at.test.js @@ -44,6 +44,10 @@ describe('test/common/at.test.js', function () { @alsotang3 ``` + ```js + @flow + ``` + ```@alsotang4``` @ @@ -87,6 +91,10 @@ jysperm@gmail.com [@alsotang](/user/alsotang) @alsotang3 ``` +```js + @flow +``` + ```@alsotang4``` @