Skip to content

Commit

Permalink
feat(tag): add pandown (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fgaoxing authored Jul 10, 2022
1 parent f6f166e commit efc1966
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions scripts/tags/pandown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

// {% pandown type, url, pwd, fname %}
hexo.extend.tag.register('pandown', function(args) {
if(/::/g.test(args)){
args = args.join(' ').split('::');
}
else{
args = args.join(' ').split(',');
}
let type = '';
let url = '';
let pwd = '';
let fname = '';
if (args.length < 4) {
return;
} else if (args[0].trim() === 'yun') {
return '<p>对不起,pandown-tags不支持自定义</p><br><p>Sorry, pandown-tags does not support customization</p>'
} else {
type = args[0].trim();
url = args[1].trim();
pwd = args[2].trim();
fname = args[3].trim();
}
let result = '';
// js
result += '<div class="tag pandown-tags"><script type="text/javascript" src="https://unpkg.com/pandown"></script>';
//pandown
result += '<pandown type="'+type+'" url="'+url+'" pwd="'+pwd+'" fname="'+fname+'"></pandown>'
//调用
result += '<script>pandown()</script></div>'
return result;
});

0 comments on commit efc1966

Please sign in to comment.