From 992bcdaf5808ce284ff79993510eab4378b23071 Mon Sep 17 00:00:00 2001
From: mRNA <1518926653@qq.com>
Date: Fri, 15 Nov 2024 13:29:08 +0800
Subject: [PATCH 1/3] try1
---
lib/extend/injector.ts | 9 ++++++++-
package.json | 6 +++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/extend/injector.ts b/lib/extend/injector.ts
index edb4a45094..0f341f519b 100644
--- a/lib/extend/injector.ts
+++ b/lib/extend/injector.ts
@@ -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' && /
\s*/.test(input)) ||
+ (flag==='body_begin' && /\s*/.test(input)) ||
+ (flag==='head_end' && /\s*<\/head>/.test(input)) ||
+ (flag==='body_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');
diff --git a/package.json b/package.json
index 965447ed7d..9adab817ed 100644
--- a/package.json
+++ b/package.json
@@ -65,16 +65,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",
From 792672d7175271401bd05f72523532ee42f8554a Mon Sep 17 00:00:00 2001
From: mRNA <1518926653@qq.com>
Date: Fri, 15 Nov 2024 17:24:52 +0800
Subject: [PATCH 2/3] change the injector judge
---
lib/extend/injector.ts | 9 +--------
test/scripts/extend/injector.ts | 1 +
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/lib/extend/injector.ts b/lib/extend/injector.ts
index 0f341f519b..06485e829c 100644
--- a/lib/extend/injector.ts
+++ b/lib/extend/injector.ts
@@ -66,14 +66,7 @@ class Injector {
}
_injector(input: string, pattern: string | RegExp, flag: Entry, isBegin = true, currentType: string): string {
- if (
- (flag==='head_begin' && /\s*/.test(input)) ||
- (flag==='body_begin' && /\s*/.test(input)) ||
- (flag==='head_end' && /\s*<\/head>/.test(input)) ||
- (flag==='body_end' && /\s*<\/body>/.test(input))
- ) {
- return input;
- }
+ if (input.includes(`');
result.should.contain('');
result.should.contain('