Commit Graph

1464 Commits

Author SHA1 Message Date
Fabien Potencier e28663efd8 fixed CS 2012-05-19 09:41:36 +02:00
Fabien Potencier 875fa010ce bumped version to 1.8.2-DEV 2012-05-17 18:06:57 +02:00
Fabien Potencier 0bee037579 prepared the 1.8.1 release v1.8.1 2012-05-17 18:02:47 +02:00
Fabien Potencier 06da8234ef merged branch Tobion/patch-5 (PR #729)
Commits
-------

b692268 removed leftover of 93c4406f8 and made some language improvements

Discussion
----------

removed leftover of 93c4406f8 and made some language improvements
2012-05-17 09:08:48 +02:00
Tobias Schultze b6922682b0 removed leftover of 93c4406f8 and made some language improvements 2012-05-17 00:21:17 +03:00
Fabien Potencier 7f06c12c53 fixed tests for PHP 5.2 2012-05-16 17:00:05 +02:00
Fabien Potencier 93c4406f87 fixed typos in the doc (closes #726) 2012-05-16 16:24:38 +02:00
Fabien Potencier 621c7b5757 updated CHANGELOG 2012-05-16 16:22:01 +02:00
Fabien Potencier 3fa5be49ab fixed CHANGELOG 2012-05-16 16:20:34 +02:00
Fabien Potencier 8ec73cf475 fixed a regression introduced by aa6b835816 2012-05-16 16:19:00 +02:00
Fabien Potencier c35e16dbd3 removed obsolete code 2012-05-16 16:01:19 +02:00
Fabien Potencier d661c2a2f6 switched to use mbstring whenever possible instead of iconv (because of issues with iconv and Japanese -- thanks @ganchiku for the tip) 2012-05-12 10:15:51 +02:00
Fabien Potencier f8e9a45388 merged branch Fustrate/master (PR #725)
Commits
-------

6c06a32 Coding style

Discussion
----------

Minor typos and coding style

- Unnecessary return in Lexer
- Typo in TokenParserBrokerInterface
2012-05-11 06:53:17 +02:00
Steven Hoffman 6c06a32663 Coding style
- Unnecessary return in Lexer
- Typo in TokenParserBrokerInterface
2012-05-10 12:10:26 -07:00
Fabien Potencier e445192f06 merged branch literal/v1.8.0 (PR #723)
Commits
-------

d13f742 fix example in doc for embed tag
b11412e improve documentation for embed tag

Discussion
----------

improve documentation for embed tag

https://github.com/fabpot/Twig/issues/722

---------------------------------------------------------------------------

by fabpot at 2012-05-10T05:10:37Z

I think this is a great improvement over the original version! The notion of "micro-layouts" certainly helps understand the concept behind the `embed` tag.

Thanks.
2012-05-10 13:36:58 +02:00
literal d13f7424eb fix example in doc for embed tag 2012-05-10 14:33:17 +03:00
literal b11412efd8 improve documentation for embed tag 2012-05-10 03:10:48 +03:00
Fabien Potencier 078905ed95 fixed dump function is_safe value when html_errors is not defined in php.ini (closes #720) 2012-05-08 14:24:57 +02:00
Fabien Potencier 925254821d bumped version to 1.9.0-DEV 2012-05-08 09:06:03 +02:00
Fabien Potencier 87766410dd prepared the 1.8.0 release v1.8.0 2012-05-08 09:03:46 +02:00
Fabien Potencier 1dc3c4beaf added documentation for the bitwise operators (closes #707) 2012-05-08 08:32:32 +02:00
Fabien Potencier 52cc3817a8 added tests for bitwise operators 2012-05-08 08:30:42 +02:00
Fabien Potencier 4cd98e62d0 clarified usage of the dump function (closes #718) 2012-05-08 08:23:16 +02:00
Fabien Potencier db32d5ef43 enforced interface when adding tests, filters, functions, and node visitors from extensions
This avoids some hard to find bugs where you use a Twig_Function_Method
for instance for a filter. This is hard to find because the interface is
almost the same but the getSafe() contract is not the same.
2012-05-04 08:00:56 +02:00
Fabien Potencier 606d6dc15e updated CHANGELOG 2012-05-03 22:31:44 +02:00
Fabien Potencier 3160189601 merged branch stof/mutable_datetime (PR #717)
Commits
-------

a23d4fb Fixed the handling of the timezone for DateTime objects
a164469 Added a failing test demonstrating the bug with DateTime and timezones

Discussion
----------

Mutable datetime

PHP DateTime objects are mutable so changing the timezone when displaying
it affects the following code whereas it does not occur for other
supported formats.
2012-05-03 22:30:26 +02:00
Christophe Coevoet a23d4fbb71 Fixed the handling of the timezone for DateTime objects 2012-05-03 22:25:04 +02:00
Christophe Coevoet a16446913a Added a failing test demonstrating the bug with DateTime and timezones
PHP DateTime objects are mutable so changing the timezone when displaying
it affects the following code whereas it does not occur for other
supported formats.
2012-05-03 22:20:20 +02:00
Fabien Potencier f3491b5cbf added a missing entry in the CHANGELOG 2012-04-28 09:16:43 +02:00
Fabien Potencier 5923f0cbad fixed markup in the doc 2012-04-27 17:50:30 +02:00
Fabien Potencier db8a109495 merged two doc files 2012-04-27 17:50:30 +02:00
Fabien Potencier bbfc7d7aef renamed a doc file 2012-04-27 17:50:27 +02:00
Fabien Potencier 50c511849f refactored the hacking twig doc chapter 2012-04-27 17:35:26 +02:00
Fabien Potencier 2a2aeee8e0 tweaked doc 2012-04-27 14:21:26 +02:00
Fabien Potencier 3697ef4a3e added a new recipe 2012-04-27 14:18:22 +02:00
Fabien Potencier 635bafd46e fixed embed compilation when used more than once in a template (closes #714) 2012-04-27 09:16:28 +02:00
Fabien Potencier 75d97b4a27 made the autoescape tag argument optional (defaults to 'html') 2012-04-25 18:22:58 +02:00
Fabien Potencier 73136d3583 added a note about auto-escaping and the embed tag
We cannot use the parent template to guess the auto-escaping strategy
either as it can be any valid expression, for which we have the real
value only at runtime (auto-escaping happening at compilation time).
2012-04-25 10:34:24 +02:00
Fabien Potencier feaaca216c ensured that each template (Twig_Node_Module) is only visited once 2012-04-25 09:17:16 +02:00
Fabien Potencier ac7907abab simplified code 2012-04-25 08:37:17 +02:00
Fabien Potencier 67c71201e6 added a way to change the default escaping strategy after creating the Twig environment 2012-04-25 08:24:12 +02:00
Fabien Potencier d458e8c892 tweaked doc for the escape filter 2012-04-25 07:35:12 +02:00
Fabien Potencier 9ecf090ae8 simplified usage of the autoescape tag; the only argument is now the escaping strategy or false 2012-04-25 07:30:52 +02:00
Fabien Potencier 423c827093 tweaked an error message 2012-04-25 07:12:38 +02:00
Fabien Potencier 1f00c33acd added a way to dynamically change the auto-escaping strategy according to the template filename 2012-04-25 07:12:38 +02:00
Fabien Potencier 109db731ca changed the autoescape option to also accept a supported escaping strategy (for BC, true is equivalent to html) 2012-04-25 07:12:34 +02:00
Fabien Potencier b0c435979f fixed CS 2012-04-25 06:17:05 +02:00
Fabien Potencier 02f1c567b9 fixed markup in the doc 2012-04-24 13:12:09 +02:00
Fabien Potencier 49c5d51eac merged branch fabpot/inline (PR #709)
Commits
-------

07f13df fixed typo
0f623a1 added the parent as an argument to the embed tag (removes the need to use extends)
fab21d8 renamed the inline tag to embed
1b54780 tweaked examples
955726a changed the inline examples to not use even/odd to avoid confustion
fb07f3a renamed indice to index
fafde80 added more info in the docs
2fa8224 added the inline tag

Discussion
----------

added the inline tag

At Sensio, we manage websites with many mostly-static pages that share almost the same structure (with different content of course), but with some subtle differences. After trying many different possibilities (external templates, inheritance, macros, and some ugly ones that I won't even tell you about ;)) to structure our templates, we came to the conclusion that we needed a new concept.

This new concept is implemented via a new tag, `inline`, which I want to include in Twig 1.8 (not for the upcoming 1.7 which is due this week). But before merging this code into master, I want to gather some feedback from the community. One of my questions being: Will you use this new possibility?

I won't tell you more here as the tag is fully documented in the diff.

---------------------------------------------------------------------------

by oojacoboo at 2012-04-23T17:58:59Z

odd/even?  What other potential uses do you see?  I think I can see a couple, but generally speaking, unless it's a content site (ie. blog), the odd/even isn't very useful.  Reusing blocks even with minor customizations on a per page level is highly needed for our development processes, but an odd/even scenario is certainly not.

Maybe I'm missing something here.  What about passing attributes to a block or something?

---------------------------------------------------------------------------

by fabpot at 2012-04-23T18:02:51Z

@oojacoboo odd/even is just an example. Of course, this is not a real use case, this was just an attempt to find an example.

---------------------------------------------------------------------------

by stof at 2012-04-23T18:03:53Z

@oojacoboo there is no reference to odd/even in the code, only in the doc

---------------------------------------------------------------------------

by simensen at 2012-04-23T18:20:10Z

I think that it would be useful in some cases. I can't think of any places I could use it *right now* but I know I've had to jump through hoops on more than a few occasions to get things to work correctly. Being able to keep functionality like this in mind at the design stage might have made things easier in a few of those cases.

---------------------------------------------------------------------------

by lyrixx at 2012-04-23T18:21:34Z

I think it's a good idea.

---------------------------------------------------------------------------

by tyomo4ka at 2012-04-23T18:25:07Z

I think it will be great. Each time when I need to include templat that simple extends another one and replace one small block I think: "Why I should to create new template for it?". Thanks, @fabpot

---------------------------------------------------------------------------

by bmatzner at 2012-04-23T18:28:23Z

Right on. +1

---------------------------------------------------------------------------

by cranberyxl at 2012-04-23T18:40:17Z

I believe the concept is a good one, but the example using even and odd will confuse frontend developers because it's usually used in the context of loops and table striping. even changing it to styleA.twig and styleB.twig would be more understandable.

---------------------------------------------------------------------------

by lyrixx at 2012-04-23T19:01:32Z

@cranberyxl  +1

---------------------------------------------------------------------------

by fabpot at 2012-04-23T19:24:21Z

ok, I've just changed the examples to not used even/odd.

---------------------------------------------------------------------------

by jorgelbg at 2012-04-23T19:27:53Z

I think that the inline tag is a valid concept, but still I can't get it landed on a real case!

---------------------------------------------------------------------------

by sirowl at 2012-04-23T19:35:07Z

As a webdesigner with a steady foundation in CSS I find the term inline very confusing, I had to consult a developer to actually understand what was the idea of the tag as I so heavily associated it with CSS's terminology of inline.
The CSS terminololigy got me on the wrong track in terms of what the tag was supposed to be used for.
I have no good suggestion for a name for it, but inline could probably get very confusing for a lot of webdesigners making use of twig.

---------------------------------------------------------------------------

by fabpot at 2012-04-23T19:41:48Z

@sirowl `inline` was the best term I could come up with but I'm open to any other suggestion.

---------------------------------------------------------------------------

by sirowl at 2012-04-23T19:47:30Z

The best I could come up with is embed, as it is an embedded document of sorts.. or something along those lines.

---------------------------------------------------------------------------

by bschussek at 2012-04-23T19:48:54Z

I like `embed`.

---------------------------------------------------------------------------

by bmatzner at 2012-04-23T19:55:37Z

Hi Fabien, inline makes sense to me, although I understand @sirowl's comment, but I even find the concept quite comparable to the CSS display:block/display:inline logic. @sirowl's suggestion of "embed" would be just as fine, as it's just a matter of learning what this particular tag refers to. The ambiguation against the import tag is probably the most crucial, explaining the advantages of "inline" (or whatever) over doing an import

---------------------------------------------------------------------------

by Baachi at 2012-04-23T20:03:26Z

I lke ```embed```, too.

---------------------------------------------------------------------------

by Nami-Doc at 2012-04-23T20:11:42Z

I like `embed`, but `inline` is fine too.

---------------------------------------------------------------------------

by tijuan at 2012-04-23T20:36:39Z

I like the feature
I like embed

---------------------------------------------------------------------------

by pulse00 at 2012-04-23T20:56:41Z

+1 for `embed`

---------------------------------------------------------------------------

by mickaelandrieu at 2012-04-24T00:35:01Z

I like embed, inline for me is an CSS behavior

---------------------------------------------------------------------------

by matheo at 2012-04-24T04:29:05Z

+1 for `embed`

---------------------------------------------------------------------------

by fabpot at 2012-04-24T05:35:06Z

I've just renamed the `inline` tag to `embed`.

---------------------------------------------------------------------------

by sirowl at 2012-04-24T06:55:17Z

@fabpot agreed, much more clear to me now. Look forward to using it.

---------------------------------------------------------------------------

by pvanliefland at 2012-04-24T07:20:35Z

I would like to use this feature as well

---------------------------------------------------------------------------

by tristanbes at 2012-04-24T07:38:57Z

So if I take another example, to help me understand better

I do have a common structure stated as follows :
   ```
 <body>
    <div class="row">
        <div class="main">
            <div id="homepage">
               {% block content %}
            </div>
       </div>
    </div>
    </body>
```
Let's say for the other pages, the `id="homepage"` is replaced by `id="innerPage"` `id="specialLayout"`

So far I created 3 base template with those changes, so with the new `embed` tag, does this concept fits here or I misunderstood the function of `embed` feature ?

---------------------------------------------------------------------------

by ruian at 2012-04-24T07:47:38Z

@tristanbes with `embed`, you can "include" another twig template and modify directly these differents `block`.
If you want to understand you can read `embed` tests https://github.com/fabpot/Twig/blob/0f623a11129ce28a897dbd5b812241d8b3ea9730/test/Twig/Tests/Fixtures/tags/embed/

---------------------------------------------------------------------------

by samuelmichaud at 2012-04-24T08:02:42Z

Yes ! I will definitely use this ! Thanks

---------------------------------------------------------------------------

by michelsalib at 2012-04-24T08:05:47Z

As @samuelmichaud said we have some uses cases (such as menu generation, breadcrumbs or quick action embedding). So this feature makes total sense.
2012-04-24 13:09:06 +02:00
Fabien Potencier 0a3516c6e6 merged branch hason/fix_test5.2 (PR #710)
Commits
-------

28bd307 Fixed guess template info for PHP 5.2

Discussion
----------

Fixed guess template info for PHP 5.2
2012-04-24 11:25:12 +02:00