diff options
author | Chris Xiong <chirs241097@gmail.com> | 2024-06-22 20:07:43 -0400 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2024-06-22 20:08:01 -0400 |
commit | abb10f112aa1248700e98caa0273f6afc5154a47 (patch) | |
tree | b8b0d76ce5f3d661eef900381e91a23ec52ec0bf /generator/util.js | |
parent | 33b8f27d45619c4cb03423cd77d30fe8566a7e18 (diff) | |
download | sbs-abb10f112aa1248700e98caa0273f6afc5154a47.tar.xz |
Yes we are 2.6 now.
Diffstat (limited to 'generator/util.js')
-rw-r--r-- | generator/util.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/generator/util.js b/generator/util.js index e9b5c78..85e7ab3 100644 --- a/generator/util.js +++ b/generator/util.js @@ -1,7 +1,8 @@ //Copyright Chris Xiong 2019 //License: Expat (MIT) module.exports={ - mtime_cmp:function(a,b){return _mtime_cmp(a,b);} + mtime_cmp: function(a, b){ return _mtime_cmp(a, b); }, + htmlescape: function(s){ return _htmlescape(s); } }; const fs=require('fs'); @@ -17,3 +18,11 @@ function _mtime_cmp(a,b) }catch(e){return false}; return mtimeb>=mtimea; } +function _htmlescape(s) +{ + return s.replace(/</g, "<") + .replace(/>/g, ">") + .replace(/&/g, "&") + .replace(/"/g, """) + .replace(/'/g, "'"); +} |