Skip to content

Commit

Permalink
try1
Browse files Browse the repository at this point in the history
  • Loading branch information
mRNA16 committed Nov 15, 2024
1 parent 492debf commit 23669c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion lib/extend/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ class Injector {
}

_injector(input: string, pattern: string | RegExp, flag: Entry, isBegin = true, currentType: string): string {
if (input.includes(`hexo injector ${flag}`)) return input;
if (
(flag==='head_begin' && /<head.*?>\s*<!-- hexo injector head_begin start -->/.test(input)) ||
(flag==='body_begin' && /<body.*?>\s*<!-- hexo injector body_begin start -->/.test(input)) ||
(flag==='head_end' && /<!-- hexo injector head_end end -->\s*<\/head>/.test(input)) ||
(flag==='body_end' && /<!-- hexo injector body_end end -->\s*<\/body>/.test(input))
) {
return input;
}

const code = this.cache.apply(`${flag}-${currentType}-code`, () => {
const content = currentType === 'default' ? this.getText(flag, 'default') : this.getText(flag, currentType) + this.getText(flag, 'default');
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@
"warehouse": "^5.0.1"
},
"devDependencies": {
"0x": "^5.1.2",
"@types/abbrev": "^1.1.3",
"@types/bluebird": "^3.5.37",
"@types/chai": "^4.3.11",
"@types/js-yaml": "^4.0.9",
"@types/mocha": "^10.0.6",
"@types/node": "^20.16.10",
"@types/mocha": "^10.0.9",
"@types/node": "^20.17.6",
"@types/nunjucks": "^3.2.2",
"@types/sinon": "^17.0.3",
"@types/text-table": "^0.2.4",
"0x": "^5.1.2",
"c8": "^9.0.0",
"chai": "^4.3.6",
"cheerio": "0.22.0",
Expand Down

0 comments on commit 23669c1

Please sign in to comment.