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

Implement multipart templates #138

Open
gvlasov opened this issue Aug 23, 2015 · 0 comments
Open

Implement multipart templates #138

gvlasov opened this issue Aug 23, 2015 · 0 comments
Assignees
Milestone

Comments

@gvlasov
Copy link
Owner

gvlasov commented Aug 23, 2015

Consider this piece of HTML:

<div class="cart">There are <div class="item">4 deer</div> in the cart</div>
<div class="cart">There is <div class="item">1 apple</div> in the cart</div>

Inflectible could be used to generate the content for cart div to inflect the verb BE (into forms are/is) and the objects (into forms deer/apple). However, a template would look like this:

website.cart(number, object) {
  There [lexeme BE]<;number> <div class="item">[number] [object]<;number></div> in the cart
}

This mixes two kinds of markup: HTML and the inflectible's markup, which is bad. Of course, we could do this in multiple templates:

website.cart.pre(number, object) {
  There [lexeme BE]<;number> 
}
website.cart.item(number, object) {
  number [object]<;number>
}
website.cart.post(number, object) {
  in the cart
}

and then assemble those parts together. But there are lots of repeated and unused code (should we leave the unused arguments in the post template?).

Thus, there should be a way to divide templates into parts that operate on the same arguments and can be accessed individually.

Markup could be like this:

website.cart(number, object) {
  pre {
    There [lexeme BE]<;number> 
  }
  item {
    [number] [object]<;number>
  }
  post {
    in the cart
  }
}

And then another, inflection-unaware, template engine will be used to construct the HTML from these three parts.

This multipart syntax should be implemented.

@gvlasov gvlasov self-assigned this Aug 23, 2015
@gvlasov gvlasov added this to the 0.5.0 milestone Aug 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant