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

[posthtml-extend] Unexpected block "title" #34

Closed
Asuka109 opened this issue Dec 31, 2020 · 1 comment
Closed

[posthtml-extend] Unexpected block "title" #34

Asuka109 opened this issue Dec 31, 2020 · 1 comment

Comments

@Asuka109
Copy link

The block tag embedded in the title tag doesn't work properly, which seems to be unique to the new version.

index.html

<extends src="base.html">
  <block name="title">Document</block>
  <block name="body">
    <p>Welcome~</p>
  </block>
</extends>

base.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>
    <block name="title">Document</block>
  </title>
</head>
<body>
  <div id="app">
    <block name="body"></block>
  </div>
</body>
</html>

And then will get:

Error: [posthtml-extend] Unexpected block "title"
    at getError (E:\repositories\wecall-qyh\node_modules\posthtml-extend\lib\index.js:1:3740)
    at mergeExtendsAndLayout (E:\repositories\wecall-qyh\node_modules\posthtml-extend\lib\index.js:1:2705)
    at E:\repositories\wecall-qyh\node_modules\posthtml-extend\lib\index.js:1:1743
    at E:\repositories\wecall-qyh\node_modules\posthtml\lib\api.js:91:45
    at traverse (E:\repositories\wecall-qyh\node_modules\posthtml\lib\api.js:105:26)
    at Array.match (E:\repositories\wecall-qyh\node_modules\posthtml\lib\api.js:90:7)
    at handleExtendsNodes (E:\repositories\wecall-qyh\node_modules\posthtml-extend\lib\index.js:1:1262)
    at E:\repositories\wecall-qyh\node_modules\posthtml-extend\lib\index.js:1:901
    at err (E:\repositories\wecall-qyh\node_modules\posthtml\lib\index.js:219:34)
    at tryCatch (E:\repositories\wecall-qyh\node_modules\posthtml\lib\index.js:300:12)

But this will works right:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <block name="title">123123</block>
</head>
<body>
  <div id="app">
    <block name="body"></block>
  </div>
</body>
</html>
@Scrum
Copy link
Member

Scrum commented Jan 11, 2021

@Scrum Scrum closed this as completed Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants