This repository has been archived by the owner on Aug 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from nextras/new_nette
Updated for Nette 2.4
- Loading branch information
Showing
17 changed files
with
177 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/composer.lock | ||
/vendor | ||
/tests/temp | ||
/tests/output |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
language: php | ||
php: | ||
- 5.6 | ||
- 7.0 | ||
|
||
matrix: | ||
fast_finish: true | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
- vendor | ||
|
||
before_script: | ||
# Install Nette Tester | ||
- phpenv config-rm xdebug.ini | ||
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then composer require --dev jakub-onderka/php-parallel-lint:~0.9.2; fi | ||
- travis_retry composer update --no-interaction --prefer-source | ||
|
||
script: | ||
- ./vendor/bin/tester ./tests/ | ||
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then vendor/bin/parallel-lint src; fi | ||
|
||
after_failure: | ||
# Print *.actual content & log content | ||
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done | ||
- for i in $(find tests -name \*.log); do echo "--- $i"; cat $i; echo; echo; done |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
## Nextras\Latte\Macros | ||
Nextras LatteMacros | ||
=================== | ||
|
||
Useful Latte Macros for Nette Framework. | ||
[![Build Status](https://travis-ci.org/nextras/latte-macros.svg?branch=master)](https://travis-ci.org/nextras/latte-macros) | ||
[![Downloads this Month](https://img.shields.io/packagist/dm/nextras/latte-macros.svg?style=flat)](https://packagist.org/packages/nextras/latte-macros) | ||
[![Stable version](http://img.shields.io/packagist/v/nextras/latte-macros.svg?style=flat)](https://packagist.org/packages/nextras/latte-macros) | ||
|
||
## Installation | ||
Useful Macros for Latte from Nette Framework. | ||
|
||
The best way to install is using [Composer](http://getcomposer.org/): | ||
### Installation | ||
|
||
```sh | ||
Use composer: | ||
|
||
```bash | ||
$ composer require nextras/latte-macros | ||
``` | ||
|
||
## Macros | ||
### Macros | ||
|
||
- **RedefineMacro** - block macro such as `{define}` macro, but the latest defined macro is used. | ||
|
||
### License | ||
|
||
MIT. See full [license](license.md). |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
{ | ||
"name": "nextras/latte-macros", | ||
"type": "library", | ||
"description": "Latte macros for Nette Framework.", | ||
"keywords": ["nextras", "nette", "latte", "macros", "block-macros"], | ||
"license": ["MIT"], | ||
"description": "Macros for Latte from Nette Framework.", | ||
"keywords": ["nextras", "nette", "latte", "macros", "redefine"], | ||
"homepage": "https://github.com/nextras/latte-macros", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Jan Skrasek", | ||
"email": "[email protected]", | ||
"homepage": "http://jan.skrasek.com" | ||
} | ||
{ "name": "Nextras Project", "homepage": "https://github.com/nextras/orm/graphs/contributors" } | ||
], | ||
"require": { | ||
"php": ">=5.3", | ||
"latte/latte": "~2.2" | ||
"php": ">=5.6", | ||
"latte/latte": "~2.4" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.1-dev" | ||
} | ||
"require-dev": { | ||
"tracy/tracy": "~2.4", | ||
"nette/tester": "~1.7" | ||
}, | ||
"autoload": { | ||
"psr-4": { "Nextras\\Latte\\Macros\\": "src/" } | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "2.0-dev" | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
use Latte\Engine; | ||
use Nextras\Latte\Macros\RedefineMacro; | ||
use Tester\Assert; | ||
use Tester\Environment; | ||
|
||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
Environment::setup(); | ||
|
||
|
||
function render($file) | ||
{ | ||
$latte = new Latte\Engine; | ||
$latte->setTempDirectory(__DIR__ . '/temp'); | ||
$latte->onCompile[] = function (Engine $engine) { | ||
RedefineMacro::install($engine->getCompiler()); | ||
}; | ||
$result = $latte->renderToString(__DIR__ . '/' . $file); | ||
return trim($result); | ||
} | ||
|
||
|
||
|
||
Assert::same('import.latte', render('case1/main.latte')); | ||
Assert::same('main.latte', render('case2/main.latte')); | ||
Assert::same('import.latte', render('case3/main.latte')); | ||
Assert::same('import.latte', render('case4/main.latte')); | ||
Assert::same('No blocks', render('case5/main.latte')); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{redefine main}import.latte{/redefine} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{import import.latte} | ||
{define main}main.latte{/define} | ||
{include main} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{redefine main}import.latte{/redefine} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{import import.latte} | ||
{redefine main}main.latte{/redefine} | ||
{include main} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{redefine main}import.latte{/redefine} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{redefine main}main.latte{/redefine} | ||
{import import.latte} | ||
{include main} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{redefine main}import.latte{/redefine} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{define main}layout.latte{/define} | ||
{include content} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{layout layout.latte} | ||
{redefine main}main.latte{/redefine} | ||
{block content} | ||
{import import.latte} | ||
{include main} | ||
{/block} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
No blocks |