diff options
-rw-r--r-- | etherpad/src/plugins/twitterStyleTags/hooks.js | 2 | ||||
-rw-r--r-- | etherpad/src/plugins/twitterStyleTags/static/js/main.js | 40 |
2 files changed, 28 insertions, 14 deletions
diff --git a/etherpad/src/plugins/twitterStyleTags/hooks.js b/etherpad/src/plugins/twitterStyleTags/hooks.js index a5513f0..003bc32 100644 --- a/etherpad/src/plugins/twitterStyleTags/hooks.js +++ b/etherpad/src/plugins/twitterStyleTags/hooks.js @@ -10,7 +10,7 @@ function handlePath() { function padModelWriteToDB(args) { /* Update tags for the pad */ - var new_tags = args.pad.text().match(new RegExp("#[^,#!\\s][^,#!\\s]*", "g")); + var new_tags = args.pad.text().match(new RegExp("#[^,#=!\\s][^,#=!\\s]*", "g")); if (new_tags == null) new_tags = new Array(); for (i = 0; i < new_tags.length; i++) new_tags[i] = new_tags[i].substring(1); diff --git a/etherpad/src/plugins/twitterStyleTags/static/js/main.js b/etherpad/src/plugins/twitterStyleTags/static/js/main.js index 07da57e..a83e3e8 100644 --- a/etherpad/src/plugins/twitterStyleTags/static/js/main.js +++ b/etherpad/src/plugins/twitterStyleTags/static/js/main.js @@ -10,24 +10,38 @@ function aceInitInnerdocbodyHead(args) { } function aceGetFilterStack(args) { - return [args.linestylefilter.getRegexpFilter( - new RegExp("#[^,#!\\s][^,#!\\s]*", "g"), 'padtag')]; + return [ + args.linestylefilter.getRegexpFilter( + new RegExp("#[^,#=!\\s][^,#=!\\s]*", "g"), 'padtag'), + args.linestylefilter.getRegexpFilter( + new RegExp("=[^#=\\s][^#=\\s]*", "g"), 'padtagsearch') + ]; } function aceCreateDomLine(args) { - if (args.cls.indexOf('padtag') < 0) - return; + if (args.cls.indexOf('padtagsearch') >= 0) { + var href; + cls = args.cls.replace(/(^| )padtagsearch:(\S+)/g, function(x0, space, padtagsearch) { + href = '/ep/tag/?query=' + padtagsearch.substring(1); + return space + "padtagsearch padtagsearch_" + padtagsearch.substring(1); + }); - var href; - cls = args.cls.replace(/(^| )padtag:(\S+)/g, function(x0, space, padtag) { - href = '/ep/tag/?query=' + padtag.substring(1); - return space + "padtag padtag_" + padtag.substring(1); - }); + return [{ + cls: cls, + extraOpenTags: '<a href="' + href.replace(/\"/g, '"') + '">', + extraCloseTags: '</a>'}]; + } else if (args.cls.indexOf('padtag') >= 0) { + var href; + cls = args.cls.replace(/(^| )padtag:(\S+)/g, function(x0, space, padtag) { + href = '/ep/tag/?query=' + padtag.substring(1); + return space + "padtag padtag_" + padtag.substring(1); + }); - return [{ - cls: cls, - extraOpenTags: '<a href="' + href.replace(/\"/g, '"') + '">', - extraCloseTags: '</a>'}]; + return [{ + cls: cls, + extraOpenTags: '<a href="' + href.replace(/\"/g, '"') + '">', + extraCloseTags: '</a>'}]; + } } /* used on the client side only */ |