Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Closes: #39 Add a way to specify the position of child components. #70
Closes: #39 Add a way to specify the position of child components. #70
Changes from 8 commits
d0e913a
af0e363
0c2f1bb
956d54c
7937443
c7ab9d5
b8d1008
4d2ac7b
bcbc8bc
02006e1
73ba5d6
2dd127a
7d79a9b
8616919
ecf7897
6efec43
6ad7037
5c8212e
bdd93d7
76a9921
e3c29ce
8e244a0
7b6da80
3e9fb64
8e8000d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
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.
field
is not neededThere 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.
we should not add trailing space here
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.
We should check if
self.root_node
isNone
.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.
shouldn't it be the other way round ?
self.children.extend(new_children)
?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.
No.
new_children
is a copy ofendtag_node.children
with<slot>
replaced byself.current_children
.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 defined
new_children
list to hold the list of current children ofendtag_node
with slot elements replaced by content ofself.current_children
, then assignednew_children
list as children ofendtag_node
.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.
It still breaks the order in case we have complex structure with nodes inside one another... I'm current looking for a solution.
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.
extra spaces
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.
same
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.
And here
__init__.fyre
is our app, and it’s making usage of ourdaily_quote.fyre component
.<daily_quote>
tag is not in ourgeneric_tags
set, (ref, parser.py line 43 and lines106...108
on handle_starttag function), “meaning that<daily_quote>
is a custom component on__init__.fyre
” and whateverinner_content
we have inside<daily_quote>
, we want to place it instead of the<slot> tag
" on the final hmtl file.That is why we need the
inner_content
list, because this content is not “normal children”, this content is what we want to add to our code in place of the<slot>
.If I keep adding this “inner content of our custom component
<daily_quote>
” to the regularchildren
list, we will have no way of telling what are the “children components akainner_content
” we want to replace the<slot>
tag with.Then on the
handle_endtag
function we check if theparente_node
is a custom component, (ref, parse.py line168 ...171
) and we are able to do this check here because we had theis_custom
property set up to be True or False on thehandle_starttag
function.If the
parent_node
isis_custom == True
then we need to save thisparent_node
children toinner_content
list where later on we will replace the<slot>
with.<slot>
is not a custom tag,<slot>
is a generic tag, kinda like a placeholder for us to know that whenever we have<slot>
on our component definition akadaily_quote.fyre
is where we will add the<inner_content>
of our custom component usage aka what is defined in__init__.fyre
And this will be the final html file after transpiler.