|
@@ -70,6 +70,24 @@ exports.swigFilters = function(app, swig) {
|
|
|
return name.replace(/.+\/(.+)?$/, '$1'); // ページの末尾を拾う
|
|
return name.replace(/.+\/(.+)?$/, '$1'); // ページの末尾を拾う
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ swig.setFilter('normalizeDateInPath', function(path) {
|
|
|
|
|
+ // warning for /(20\d{4}|20\d{6}|20\d{2}_\d{1,2}|20\d{2}_\d{1,2}_\d{1,2})/
|
|
|
|
|
+ if (path.match(/20(\d{2})(\d{2})(\d{2})/g)) {
|
|
|
|
|
+ return path.replace(/20(\d{2})(\d{2})(\d{2})/g, '20$1/$2/$3');
|
|
|
|
|
+ }
|
|
|
|
|
+ if (path.match(/20(\d{2})(\d{2})/g)) {
|
|
|
|
|
+ return path.replace(/20(\d{2})(\d{2})/g, '20$1/$2');
|
|
|
|
|
+ }
|
|
|
|
|
+ if (path.match(/20(\d{2})_(\d{1,2})_(\d{1,2})/g)) {
|
|
|
|
|
+ return path.replace(/20(\d{2})_(\d{1,2})_(\d{1,2})/g, '20$1/$2/$3');
|
|
|
|
|
+ }
|
|
|
|
|
+ if (path.match(/20(\d{2})_(\d{1,2})/g)) {
|
|
|
|
|
+ return path.replace(/20(\d{2})_(\d{1,2})/g, '20$1/$2');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return path;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
swig.setFilter('datetz', function(input, format) {
|
|
swig.setFilter('datetz', function(input, format) {
|
|
|
// timezone
|
|
// timezone
|
|
|
var swigFilters = require('swig/lib/filters');
|
|
var swigFilters = require('swig/lib/filters');
|