Skip to content
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

Fix closing "html" tag appears twice. #123

Merged
merged 1 commit into from
Feb 27, 2019
Merged

Fix closing "html" tag appears twice. #123

merged 1 commit into from
Feb 27, 2019

Conversation

KentarouTakeda
Copy link
Contributor

The result of hexo g immediately after executing hexo init is as follows.

$ hexo g
$ grep -A 2 -B 2 '</html>' public/index.html
  <link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
  <div id="container">
--
--
  </div>
</body>
</html>

Tag </html> appears twice. The first appears before opening <body> tag.

@yoshinorin
Copy link
Member

Thank you for your contribution.

But, I can't reproduce it. Would you please tell me detail ?
e.g) hexo version, _config.yml etc...

@KentarouTakeda
Copy link
Contributor Author

Sorry for lack of explanation.

That is default configuration after hexo init.
Therefore all configration files are same as hexojs/hexo-starter.

Lockfile is here.
Other environment and logs are as follows.

$ hexo version
hexo-cli: 1.1.0
os: Darwin 18.2.0 darwin x64
http_parser: 2.8.0
node: 10.15.0
v8: 6.8.275.32-node.45
uv: 1.23.2
zlib: 1.2.11
ares: 1.15.0
modules: 64
nghttp2: 1.34.0
napi: 3
openssl: 1.1.0j
icu: 62.1
unicode: 11.0
cldr: 33.1
tz: 2018e
$ hexo init hexo-landscape-test
INFO  Cloning hexo-starter to ~/tmp/hexo-landscape-test
Cloning into '/Users/takeda/tmp/hexo-landscape-test'...
remote: Enumerating objects: 68, done.
remote: Total 68 (delta 0), reused 0 (delta 0), pack-reused 68
Unpacking objects: 100% (68/68), done.
Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme-landscape.git) registered for path 'themes/landscape'
Cloning into '/Users/takeda/tmp/hexo-landscape-test/themes/landscape'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 867 (delta 0), reused 0 (delta 0), pack-reused 866
Receiving objects: 100% (867/867), 2.55 MiB | 2.89 MiB/s, done.
Resolving deltas: 100% (459/459), done.
Submodule path 'themes/landscape': checked out '73a23c51f8487cfcd7c6deec96ccc7543960d350'
INFO  Install dependencies
yarn install v1.12.3
info No lockfile found.
[1/4] 🔍  Resolving packages...
warning hexo > titlecase@1.1.2: no longer maintained
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.13.0", while you're on "1.12.3".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
✨  Done in 25.97s.
INFO  Start blogging with Hexo!
$ cd hexo-landscape-test
$ hexo g
INFO  Start processing
INFO  Files loaded in 198 ms
INFO  Generated: index.html
INFO  Generated: archives/index.html
INFO  Generated: fancybox/blank.gif
INFO  Generated: fancybox/jquery.fancybox.css
INFO  Generated: fancybox/fancybox_loading@2x.gif
INFO  Generated: fancybox/fancybox_loading.gif
INFO  Generated: fancybox/fancybox_overlay.png
INFO  Generated: fancybox/fancybox_sprite@2x.png
INFO  Generated: archives/2019/01/index.html
INFO  Generated: fancybox/fancybox_sprite.png
INFO  Generated: archives/2019/index.html
INFO  Generated: css/fonts/fontawesome-webfont.eot
INFO  Generated: js/script.js
INFO  Generated: fancybox/helpers/jquery.fancybox-buttons.css
INFO  Generated: fancybox/jquery.fancybox.pack.js
INFO  Generated: css/fonts/fontawesome-webfont.svg
INFO  Generated: fancybox/helpers/jquery.fancybox-thumbs.js
INFO  Generated: css/style.css
INFO  Generated: fancybox/helpers/jquery.fancybox-media.js
INFO  Generated: css/fonts/FontAwesome.otf
INFO  Generated: fancybox/helpers/jquery.fancybox-thumbs.css
INFO  Generated: fancybox/helpers/jquery.fancybox-buttons.js
INFO  Generated: fancybox/helpers/fancybox_buttons.png
INFO  Generated: css/fonts/fontawesome-webfont.woff
INFO  Generated: css/fonts/fontawesome-webfont.ttf
INFO  Generated: 2019/01/13/hello-world/index.html
INFO  Generated: css/images/banner.jpg
INFO  Generated: fancybox/jquery.fancybox.js
INFO  28 files generated in 539 ms
$ grep -A 2 -B 2 '</html>' public/index.html
  <link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
  <div id="container">
--
--
  </div>
</body>
</html>

But I also can't reproduce it in the following PoC.

$ node
> const ejs = require('ejs')
undefined
> ejs.render('<html><head></head>')
'<html><head></head>'

So it might be another cause, if so it should be solved in another fundamental way(in hexo core?), I don't know...

Copy link
Contributor

@tomap tomap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and reproduced.
EJS does not seem to like opening a tag inside a partial and closing it outside of it

@tomap
Copy link
Contributor

tomap commented Feb 25, 2019

@yoshinorin I used latest hexo to reproduce:
you can do it too:
grab this: https://github.com/tomap/hexo-theme-minidyne-demo/
insert this theme
change the _config.yml
see the result, use edge, it will display a clear warning about the because the was inserted by EJS above it
Please merge when you want

@yoshinorin yoshinorin merged commit df1b1ca into hexojs:master Feb 27, 2019
@yoshinorin
Copy link
Member

Thank you for your contribution :)

Sorry, I used & tested little bit older code 😓
I reproduce it latest code (98d865b)

@KentarouTakeda
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants