-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc: add meta generator injection filter #3129
Conversation
lib/plugins/filter/meta_generator.js
Outdated
@@ -0,0 +1,18 @@ | |||
'use strict'; | |||
|
|||
const rMetaGenerator = /<meta\s+name=['|"]?generator['|"]?/i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current code will recognize incorrect expressions as html.
<meta name="generator'>
Also, |
is described in the character set, this expression will detect <meta name=|generato |>
. Is this just as intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prepared regExp which seems to be able to express the intention of writing regExp.
/<meta\s+name=(["']?)generator\1(?: [^>\n]+)?>/i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for review! And the task about this in 4.0 Roadmap could be marked as finished. |
Thank you for creating a pull request to contribute to Hexo code! Before you open the request please review the following guidelines and tips to help it be more easily integrated:
This implements the
meta generator injection
feature. For more information, see Miscellaneous section of Hexo 4.0 Roadmap, and hexojs/site#649.