Skip to content

Commit 520a8df

Browse files
rastographicsdg
authored andcommitted
Grammar corrected in documentation (#1044)
Some English grammar corrections that make the documentation a little easier to understand and sound more professional.
1 parent 5dc3074 commit 520a8df

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

latte/en/template-inheritance.texy

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Template Inheritance and Reusability
22
************************************
33

44
.[perex]
5-
Template reusability and inheritance mechanisms are here to boosts your productivity because each template contains only its unique contents and the repeated elements and structures are reused. We introduce three concepts: [#layout inheritance], [#horizontal reuse] and [#unit inheritance].
5+
Template reusability and inheritance mechanisms are here to boost your productivity because each template contains only its unique contents and the repeated elements and structures are reused. We introduce three concepts: [#layout inheritance], [#horizontal reuse] and [#unit inheritance].
66

77
The concept of Latte template inheritance is similar to PHP class inheritance. You define a **parent template** that other **child templates** can extend from and can override parts of the parent template. It works great when elements share a common structure. Sounds complicated? Don't worry, it's not.
88

@@ -30,7 +30,7 @@ Let’s look at layout template inheritance by starting with an example. This is
3030
</html>
3131
```
3232

33-
The `{block}` tags defines three blocks that child templates can fill in. All the block tag does is to tell the template engine that a child template may override those portions of the template by defining their own block of the same name.
33+
The `{block}` tags define three blocks that child templates can fill in. All the block tag does is tell the template engine that a child template may override those portions of the template by defining their own block of the same name.
3434

3535
A child template might look like this:
3636

@@ -46,7 +46,7 @@ A child template might look like this:
4646

4747
The `{layout}` tag is the key here. It tells the template engine that this template “extends” another template. When Latte renderes this template, first it locates the parent – in this case, `layout.latte`.
4848

49-
At that point, the template engine will notice the three block tags in `layout.latte` and replace those blocks with the contents of the child template. Note that since the child template didn’t define the *footer* block, the contents from the parent template is used instead. Content within a `{block}` tag in a parent template is always used as a fallback.
49+
At that point, the template engine will notice the three block tags in `layout.latte` and replace those blocks with the contents of the child template. Note that since the child template didn’t define the *footer* block, the content from the parent template is used instead. Content within a `{block}` tag in a parent template is always used as a fallback.
5050

5151
The output might look like:
5252

@@ -76,7 +76,7 @@ In a child template, blocks can only be located either at the top level or insid
7676
{/block}
7777
```
7878

79-
Also a block will always be created in regardless of whether the surrounding `{if}` condition is evaluated to be true or false. Contrary to what you might think, this template does define a block.
79+
Also a block will always be created regardless of whether the surrounding `{if}` condition is evaluated to be true or false. Contrary to what you might think, this template does define a block.
8080

8181
```latte
8282
{if false}
@@ -96,7 +96,7 @@ If you want the output inside block to be displayed conditionally, use the follo
9696
{/block}
9797
```
9898

99-
Data outside of a blocks in a child template are executed before the layout template is rendered, thus you can use it to define variables like `{var $foo = bar}` and propagate data to the whole inheritance chain:
99+
Data outside of blocks in a child template are executed before the layout template is rendered, thus you can use it to define variables like `{var $foo = bar}` and propagate data to the whole inheritance chain:
100100

101101
```latte
102102
{layout 'layout.latte'}
@@ -213,7 +213,7 @@ The tag can also be written as [n:attribute|syntax#n:attributes]:
213213
Local Blocks
214214
------------
215215

216-
Every block overrides content of parent block of the same name. Except for local blocks. They are something like private methods in class. You can create a template without worrying that – due to coincidence of block names – they would be overwritten by second template.
216+
Every block overrides content of parent block of the same name. Except for local blocks. They are something like private methods in class. You can create a template without worrying that – due to coincidence of block names – they would be overwritten by a second template.
217217

218218
```latte
219219
{block local helper}
@@ -236,13 +236,13 @@ To print a block in a specific place, use the `{include blockname}` tag:
236236
<h1>{include title}</h1>
237237
```
238238

239-
You can also display block from another template:
239+
You can also display a block from another template:
240240

241241
```latte
242242
{include footer from 'main.latte'}
243243
```
244244

245-
Printed block have not access to the variables of the active context, except if the block is defined in the same file where it is included. However they have access to the global variables.
245+
Printed blocks do not have access to the variables of the active context, except if the block is defined in the same file where it is included. However they do have access to the global variables.
246246

247247
You can pass variables to the block in the following way:
248248

@@ -257,7 +257,7 @@ You can use a variable or any expression in PHP as the block name. In this case,
257257
{include block $name}
258258
```
259259

260-
Block can also be printed inside itself, which is useful, for example, when rendering a tree structure:
260+
A block can also be printed inside itself, which is useful, for example, when rendering a tree structure:
261261

262262
```latte
263263
{define menu, $items}
@@ -275,7 +275,7 @@ Block can also be printed inside itself, which is useful, for example, when rend
275275
{/define}
276276
```
277277

278-
Instead of `{include menu, ...}` we can also write `{include this, ...}` where `this` means current block.
278+
Instead of `{include menu, ...}` we can also write `{include this, ...}` where `this` means the current block.
279279

280280
Printed content can be modified by [filters|syntax#filters]. The following example removes all HTML and title-cases it:
281281

@@ -332,7 +332,7 @@ Imagine you have a helper template with a collection of definitions on how to dr
332332
{/define}
333333
```
334334

335-
Arguments of a definitions are always optional with default value `null`, unless default value is specified (here `'text'` is the default value for `$type`). Parameter types can also be declared: `{define input, string $name, ...}`.
335+
Arguments of a definition are always optional with default value `null`, unless default value is specified (here `'text'` is the default value for `$type`). Parameter types can also be declared: `{define input, string $name, ...}`.
336336

337337
The template with the definitions is loaded using [`{import}` |#horizontal-reuse]. The definitions themselves are rendered [in the same way as the blocks |#Printing Blocks]:
338338

@@ -409,7 +409,7 @@ Tips
409409
----
410410
Here are some tips for working with blocks:
411411

412-
- The last top-level block does not need to have closing tag (block ends with the end of the document). This simplifies the writing of child templates, which one primary block.
412+
- The last top-level block does not need to have closing tag (block ends with the end of the document). This simplifies the writing of child templates with one primary block.
413413

414414
- For extra readability, you can optionally give a name to your `{/block}` tag, for example `{/block footer}`. However, the name must match the block name. In larger templates, this technique helps you see which block tags are being closed.
415415

@@ -480,7 +480,7 @@ The unit inheritance takes the idea of layout inheritance to the level of conten
480480

481481
In unit inheritance the `{embed}` tag is the key. It combines the behavior of `{include}` and `{layout}`. It allows you to include another template’s or block's contents and optionally pass variables, just like `{include}` does. It also allows you to override any block defined inside the included template, like `{layout}` does.
482482

483-
For example we are going to use the collapsible accordion element. Let’s take a look at the element skeleton in template `collapsible.latte`:
483+
For example, we are going to use the collapsible accordion element. Let’s take a look at the element skeleton in the template `collapsible.latte`:
484484

485485
```latte
486486
<section class="collapsible {$modifierClass}">
@@ -494,9 +494,9 @@ For example we are going to use the collapsible accordion element. Let’s take
494494
</section>
495495
```
496496

497-
The `{block}` tags defines two blocks that child templates can fill in. Yes, like in the case of parent template in the layout inheritance template. You also see `$modifierClass` variable.
497+
The `{block}` tags defines two blocks that child templates can fill in. Yes, like in the case of parent template in the layout inheritance template. You also see a `$modifierClass` variable.
498498

499-
Let's use our element in template. This is where `{embed}` comes in. It’s a super powerful piece of kit that lets us do all the things: include element's template contents, add variables to it, and add blocks with custom HTML to it:
499+
Let's use our element in a template. This is where `{embed}` comes in. It’s a super powerful piece of kit that lets us do all the things: include an element's template contents, add variables to it, and add blocks with custom HTML to it:
500500

501501
```latte
502502
{embed 'collapsible.latte', modifierClass: my-style}
@@ -526,7 +526,7 @@ The output might look like:
526526
</section>
527527
```
528528

529-
Blocks inside embed tags form a separate layer independent of other blocks. Therefore, they can have the same name as the block outside the embed and are not affected in any way. Using the tag [include|#Printing Blocks] inside `{embed}` tags you can insert blocks here created, blocks from embedded template (which *are not* [local|#Local Blocks]), and also blocks from main template which *are* local. You can also [import blocks|#Horizontal Reuse] from other files:
529+
Blocks inside embed tags form a separate layer independent of other blocks. Therefore, they can have the same name as the block outside the embed and are not affected in any way. Using the tag [include|#Printing Blocks] inside `{embed}` tags you can insert blocks created here, blocks from an embedded template (which *are not* [local|#Local Blocks]), and also blocks from the main template which *are* local. You can also [import blocks|#Horizontal Reuse] from other files:
530530

531531
```latte
532532
{block outer}…{/block}
@@ -547,7 +547,7 @@ Blocks inside embed tags form a separate layer independent of other blocks. Ther
547547
{/embed}
548548
```
549549

550-
Embeded templates have not access to the variables of the active context, but they have access to the global variables.
550+
Embedded templates do not have access to the variables of the active context, but they do have access to the global variables.
551551

552552
With `{embed}` you can insert not only templates but also other blocks, so the previous example could be written like this:
553553

@@ -580,7 +580,7 @@ If we pass an expression to `{embed}` and it is not clear whether it is a block
580580
Use Cases
581581
=========
582582

583-
There are various types of inheritance and code reuse in Latte. Let's summarize the main concepts for more clearance:
583+
There are various types of inheritance and code reuse in Latte. Let's summarize the main concepts for more clarity:
584584

585585

586586
`{include template}`

0 commit comments

Comments
 (0)