This repository was archived by the owner on Nov 21, 2019. It is now read-only.
Use Twig macros rather than including templates - #76
Merged
Conversation
Contributor
Author
thewilkybarkid
commented
Apr 2, 2019
thewilkybarkid
commented
Apr 3, 2019
| {%- set attributes = attributes|default({})|merge({class: attributes.class|default([])|merge(['paragraph']) }) -%} | ||
|
|
||
| </p> | ||
| {{- html.element('p', text, attributes) -}} |
Contributor
Author
There was a problem hiding this comment.
Not sure this is better.
Contributor
Author
There was a problem hiding this comment.
Going to revert this. Bit too much magic.
thewilkybarkid
commented
Apr 3, 2019
| {%- import 'atoms-html' as html -%} | ||
|
|
||
| {%- include 'atoms-text' with {nodes: text} -%} | ||
| {%- set attributes = attributes|default({})|merge({class: attributes.class|default([])|merge(['paragraph']) }) -%} |
Contributor
Author
There was a problem hiding this comment.
Been going round the houses trying to find a way to improve this. Can't, and keep coming back to #40...
thewilkybarkid
marked this pull request as ready for review
April 3, 2019 13:46
davidcmoulton
left a comment
Contributor
There was a problem hiding this comment.
Not au fait with the details of this, but looks okay form a cursory look.
davidcmoulton
approved these changes
Apr 9, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.


Replaces the
_attributes.twigand the badly-named_text.twigtemplates with macros.(Might be some other things where macros make sense, to be investigated.)