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

Merged
merged 2 commits into from Apr 20, 2018

Conversation

3 participants
@h404bi
Contributor

h404bi commented Apr 20, 2018

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:

  • Add test cases for the changes.
  • Passed the CI test.

This implements the meta generator injection feature. For more information, see Miscellaneous section of Hexo 4.0 Roadmap, and hexojs/site#649.

@coveralls

This comment has been minimized.

coveralls commented Apr 20, 2018

Coverage Status

Coverage increased (+0.007%) to 97.222% when pulling 3ed25c9 on h404bi:feature/meta-generator into 373b9c7 on hexojs:master.

@@ -0,0 +1,18 @@
'use strict';
const rMetaGenerator = /<meta\s+name=['|"]?generator['|"]?/i;

This comment has been minimized.

@segayuu

segayuu Apr 20, 2018

Contributor

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?

This comment has been minimized.

@segayuu

segayuu Apr 20, 2018

Contributor

I prepared regExp which seems to be able to express the intention of writing regExp.

/<meta\s+name=(["']?)generator\1(?: [^>\n]+)?>/i

This comment has been minimized.

@h404bi

h404bi Apr 20, 2018

Contributor

@segayuu Oops, didn't notice that, I took that regExp from hugo. I'll make a tweak. I'm considering to use cheerio to detect this meta tag.

@segayuu

LGTM

@segayuu segayuu merged commit 30fcc4f into hexojs:master Apr 20, 2018

4 checks passed

codeclimate All good!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.007%) to 97.222%
Details
@h404bi

This comment has been minimized.

Contributor

h404bi commented Apr 20, 2018

Thanks for review! And the task about this in 4.0 Roadmap could be marked as finished.
cc @NoahDragon

@h404bi h404bi deleted the h404bi:feature/meta-generator branch Apr 20, 2018

NoahDragon added a commit to hexojs/site that referenced this pull request Nov 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment