From 37e0e9cc51b12309f235c5d16e83ed44aefc4ce1 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Fri, 23 Jul 2021 12:34:49 +0800 Subject: [PATCH] copy_id --- scripts/tags/copy.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/tags/copy.js b/scripts/tags/copy.js index 2f49273..2be21dd 100644 --- a/scripts/tags/copy.js +++ b/scripts/tags/copy.js @@ -9,6 +9,8 @@ 'use strict'; +var copy_index = 0; + hexo.extend.tag.register('copy', function(args) { args = hexo.args.map(args, ['width', 'git'], ['text']); if (args == undefined || args.text == undefined) { @@ -27,9 +29,8 @@ hexo.extend.tag.register('copy', function(args) { text = 'https://github.com/' + text + '.git'; } } - function generate_id(text) { - return 'copy-' + text.replace(/[^a-z|0-9|.:]/gi, '') - } + + const copy_id = 'copy-' + ++copy_index + '-' + text.replace(/[^a-z|0-9|.:]/gi, ''); var el = ''; el += '
'; - el += '';