mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2025-12-06 02:30:46 -08:00
Extend encodeuricomponent to process additional characters (#7128)
* First commit * Fix version number in docs * Add code comment
This commit is contained in:
parent
a3a1eceb4a
commit
a5894946de
11 changed files with 28 additions and 12 deletions
|
|
@ -685,6 +685,16 @@ exports.escapeRegExp = function(s) {
|
|||
return s.replace(/[\-\/\\\^\$\*\+\?\.\(\)\|\[\]\{\}]/g, '\\$&');
|
||||
};
|
||||
|
||||
/*
|
||||
Extended version of encodeURIComponent that encodes additional characters including
|
||||
those that are illegal within filepaths on various platforms including Windows
|
||||
*/
|
||||
exports.encodeURIComponentExtended = function(s) {
|
||||
return encodeURIComponent(s).replace(/[!'()*]/g,function(c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
};
|
||||
|
||||
// Checks whether a link target is external, i.e. not a tiddler title
|
||||
exports.isLinkExternal = function(to) {
|
||||
var externalRegExp = /^(?:file|http|https|mailto|ftp|irc|news|obsidian|data|skype):[^\s<>{}\[\]`|"\\^]+(?:\/|\b)/i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue