-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); |