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

Qute: consider composition syntax #8750

Closed
FroMage opened this issue Apr 22, 2020 · 3 comments · Fixed by #15842
Closed

Qute: consider composition syntax #8750

FroMage opened this issue Apr 22, 2020 · 3 comments · Fixed by #15842
Labels
area/qute The template engine kind/enhancement New feature or request
Milestone

Comments

@FroMage
Copy link
Member

FroMage commented Apr 22, 2020

Currently, composition is done using this syntax:

base.html (declaration):

<html>
<head>
<meta charset="UTF-8">
<title>{#insert title}Default Title{/}</title> 
</head>
<body>
  {#insert body}No body!{/} 
</body>
</html>

index.html (usage):

{#include base} 
  {#title}My Title{/title} 
  {#body}
    <div>
      My body.
    </div>
  {/body}
{/include}

Perhaps we could consider a shorter syntax:

base.html (declaration):

<html>
<head>
<meta charset="UTF-8">
<title>{#insert title}Default Title{/}</title> 
</head>
<body>
  {#insert}No body!{/} 
</body>
</html>

index.html (usage):

{#set title}My Title{/} 
{#extend base/}
<div>
  My body.
</div>

Where #insert with no name would default to whatever content is specified after #extend?

@FroMage FroMage added kind/enhancement New feature or request area/qute The template engine labels Apr 22, 2020
@quarkusbot
Copy link

/cc @mkouba

@mkouba
Copy link
Contributor

mkouba commented Mar 17, 2021

TBH the proposed syntax does not make much sense to me but we could consider some defaults, i.e. the default name for {#insert} with no name and possibly use the content of the include tag as the default block:

{#include base} 
  {#title}My Title{/title} 
   <div>
     This will be used for the insert with no name.
   </div>
{/include}

@FroMage
Copy link
Member Author

FroMage commented Mar 17, 2021

That would already go a long way, I like this!

mkouba added a commit to mkouba/quarkus that referenced this issue Mar 18, 2021
- the main block of the include section can be used for insert sections
with no name param
- minor parser cleanup
- resolves quarkusio#8750
@quarkus-bot quarkus-bot bot added this to the 1.14 - main milestone Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/qute The template engine kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants