You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a light issue when using append when used inside an inherited layout. The append behave as expected (it works) but it also throws in a warning. This only happens with at least two levels of "extends".
Example:
layout.pug
doctype html
html
head
title Test
body
h1 Header
blockcontent
br
br
p Footer
layout2.pug
extendslayoutblockcontent
p Testing
test.pug
extendslayout2appendcontent
p Working without warning.
Executing the test.pug rendering gets me the good result, but with the following warning (which does not appears if you have only one level of extends).
Warning: Undefined property: Jade\Nodes\Block::$mode in /var/www/html/vendor/pug-php/pug/src/Jade/Parser.php on line 426
I'm not sure why it happens with multiple inherited files only, but a simple fix would be to verify if the $mode property is set in the method affected by the warning to avoid it. I added the following lines in the method parseBlock() just after the $prev = &$this->blocks[$name]; line :
if (!isset($prev->mode)) {
return$this->blocks[$name];
}
It fixed the problem in my local version. I was wondering if such a fix would be possible or if you had a better one 😊.
Thank you very much for your time!
The text was updated successfully, but these errors were encountered:
Please note that there's another issue related to append if you use multiple append with the same context of multiple inherited files. The issue case was for one append block type ... if I would have another file extending with another append somehow the first element of the block doesn't appear (it keeps only the two append value). If you want I can open another issue for this specific case, but since it must be around the same code maybe there's a quick fix you may know of.
Hello,
I encountered a light issue when using
append
when used inside an inherited layout. Theappend
behave as expected (it works) but it also throws in a warning. This only happens with at least two levels of "extends".Example:
layout.pug
layout2.pug
test.pug
Executing the test.pug rendering gets me the good result, but with the following warning (which does not appears if you have only one level of extends).
I'm not sure why it happens with multiple inherited files only, but a simple fix would be to verify if the
$mode
property is set in the method affected by the warning to avoid it. I added the following lines in the methodparseBlock()
just after the$prev = &$this->blocks[$name];
line :It fixed the problem in my local version. I was wondering if such a fix would be possible or if you had a better one 😊.
Thank you very much for your time!
The text was updated successfully, but these errors were encountered: