A complete and fully-functional implementation of the Jade template language for PHP

Related tags

Templating tale-jade

Tale Jade for PHP

GitHub release Travis Packagist HHVM License Gitter

Finally a fully-functional, complete and clean port of the Jade language to PHP

— Abraham Lincoln

The Tale Jade Template Engine brings the popular and powerful Templating-Language Jade for Node.js to PHP!

Tale Jade is the first complete and most powerful Jade implementation in PHP.

Since the official implementation of Jade has been renamed to PugJS, Tale Jade has been renamed to Tale Pug!

You can still use this implementation freely, but this repository won't receive updates anymore.

You can find all documentation over at the Pug Repository.

Visit the Tale Pug Repository

  • Alternative name

    Alternative name

    We need a new name.

    4 Characters maximum.

    Can I have some input on this? Maybe even some name suggestions?

    Any idea or feedback is welcome :)

    Current Name-Suggestions by probability that I'll take them:

    • Chi (.chi, .jade, .jd)
    • Shi (.shi, .jade, .jd)
    • Inu (.inu, .jade, .jd)

    Update (15.12.2016):

    Tale Jade will be Phug in the future, a collaboration project of currently existing Jade/Pug implementations

    help wanted refactoring needed 
    opened by TorbenKoehn 32
  • Allow arbitrary spacing/indentation in php code block and text block (multiline)

    Allow arbitrary spacing/indentation in php code block and text block (multiline)

    This is kind of annoying bug to my experience. Let's take an example:

         * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
         * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
    doctype html

    This snippet gives me Jade parse error, it says like this: Failed to parse jade: Mixed indentation style encountered. Dont mix tabs and spaces. Stick to one of both. (Line: 3, Offset: 2)

    opened by elquimista 31
  • Buffered code blocks

    Buffered code blocks

    It would be incredible useful to have support for buffered code blocks, because PHP code is so messy. :)

    I have to resort to this hack when dealing with a buffered object:

        $columns = ['id','tracker_id', 'project_id', 'subject',
        'description:ntext', 'issue_category_id', 'user_id', ['class' => 'yii\\grid\\ActionColumn',
         'contentOptions' => ['nowrap'=>'nowrap'] ] ]
      !=GridView::widget(['dataProvider'=> $dataProvider,'filterModel'=> $searchModel,'columns'=> $columns])
    opened by jacmoe 18
  • Need help creating documentation!

    Need help creating documentation!

    I really need help creating more documentation resources.

    If anyone is willing to help, I'd provide everything needed including an information channel that knows all deep secrets of Jade (me).

    What I need exactly is:

    1. PHP Doc Blocks in the 1.5 and 1.6 branches (many doc blocks...)
    2. A real (possibly Jade&Bootstrap powered) Open Source website that will be hosted at http://jade.talesoft.io containing
      • The sandbox (Might also be re-written)
      • Installation and usage guides
      • A list of all common features of Tale Jade
      • A list of advanced techniques with Tale Jade (There are quite a few, I just forget them when I try to write them down)
      • A developer's guide for extending Tale Jade (Necessary after 1.5)
    3. Maybe a new README that is cleaner to read and references the website correctly
    4. Maybe, just maybe, a really cool and actually working phpdoc-template.
    5. A logo! (Maybe with a neat Jade-stone or something like that)

    Any help is appreciated

    help wanted 
    opened by TorbenKoehn 14
  • Another interpolation issue

    Another interpolation issue

    Here's an example:

    .col.s6.right-align #[strong Sign In] / !{$view->Html->link('Sign Up', ['action' => 'add'])}

    This should be interpreted as:

    <div class="col s6 right-align">
        Sign In 
      </strong> / <?=$view->Html->link('Sign Up', ['action' => 'add'])?>

    But it's misinterpreted like this:

    <div class="col s6 right-align">
        Sign In] / <?=$view->Html->link('Sign Up', ['action' => 'add'

    I confirmed it on talejade sandbox.

    I think this is caused by wrong lookup of matching brackets during interpolation processing.

    opened by elquimista 14
  • Inconsistent unbuffered code

    Inconsistent unbuffered code

    First of all: thanks for making this library!

    I am fully aware that it is wet paint, but I've decided to take the plunge - after examining the alternatives - and integrate this with Yii2.

    It really threw me for a loop, when I discovered - after many cryptic error messages - that I should not prepend conditional php code with the dash:

    if $something

    If would be better, and more consistent, to let that be unbuffered code:

    - if $something


    -if $something

    If it threw me, it would probably trip someone else up as well. :)

    opened by jacmoe 14
  • Nested mixin call before definition error

    Nested mixin call before definition error

    Calling in mixin other mixin defined later in same file with params cause Compiler exception

    2 0.0289 334680 Tale\Jade\Renderer->render( ) 3 0.0342 344896 Tale\Jade\Renderer\Adapter\File->render( ) .../Renderer.php:340 4 0.0361 345432 Tale\Jade\Renderer->compileFile( ) .../File.php:173 5 0.0361 345480 Tale\Jade\Compiler->compileFile( ) .../Renderer.php:316 6 0.0389 347288 Tale\Jade\Compiler->compile( ) .../Compiler.php:542 7 0.6745 1275980 Tale\Jade\Compiler->handleMixins( ) .../Compiler.php:476 8 0.7064 1334288 Tale\Jade\Compiler->handleMixin( ) .../Compiler.php:1268 9 0.7065 1334432 Tale\Jade\Compiler->compileChildren( ) .../Compiler.php:1297 10 0.7065 1334916 Tale\Jade\Compiler->compileNode( ) .../Compiler.php:1892 11 0.7065 1335264 call_user_func:{/adv/vhosts/vsk.a.adv.ru/personal/vendor/talesoft/tale-jade/Compiler.php:925} ( ) .../Compiler.php:925 12 0.7065 1335280 Tale\Jade\Compiler->compileMixinCall( ) .../Compiler.php:925

    Following example cause this error: `mixin a(a) a= a +b(a) mixin b(b) b=b


    opened by ArSharlahy 13
  • Official Jade has different whitespace handling

    Official Jade has different whitespace handling

    Considering this:

    span foo
    | bar

    The offical Jade engine compiles this to:


    While Tale Jade gives me this (regardless of the pretty output setting):


    So Tale Jade makes it rather hard to have the two parts joined without a space. One of the reasons I love Jade is that it always flattens whitespace, and you have to explicitly add spaces if you want them.

    enhancement pug-inconsistency 
    opened by lensco 12
  • Loading same file for simple content loading and js content loading

    Loading same file for simple content loading and js content loading

    Is there a way that I can create a single file and use for both purpose. One I am loading the contents setting some variable and if the content will send from js it will replace those variables?

    opened by aavrug 9
  • Another issue with latest version (v1.3.4)

    Another issue with latest version (v1.3.4)

    This issue is related to include statement.


    h2 Hello


    include mixin.jade

    After compilation, it should generate only 1.html with the following contents:


    But the result is it generates 1.html as well as mixin.html. And the contents are not good. mixin.html



    h2 Hello

    This is certainly a bug right?

    opened by elquimista 9
  • Code blocks

    Code blocks

    I get this error when I try to use block buffered code:

    Failed to parse jade: You should indent in by one level only

    This kind of code can reproduce the error:

              $menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username . ')',
                             'url' => ['/site/logout'],'linkOptions' =>['data-method' => 'post']]
    opened by jacmoe 9
  • check template's filemtime() before taking compiled from cache

    check template's filemtime() before taking compiled from cache

    When ttl option is set, tale-jade does not care whether source template was changed or not. It just sends cached file to render.

    It would be desirable to have an option to check source tempate filemtime() previously. And if source template was changed, regenerate the cache for it.

    E. g. 'auto_update' => true|false.

    opened by cronfy 10
  • Automatic isset-checks behave differently in different cases

    Automatic isset-checks behave differently in different cases

    Consider this code:

    p #{$var}


      <?=htmlentities(isset($var) ? $var : '', \ENT_QUOTES, 'UTF-8')?>
      <?=htmlentities($var, \ENT_QUOTES, 'UTF-8')?>

    First occurence was checked by isset, and second was not.

    1. Is it possible to configure isset checks to behave the same way through all the code?
    2. It is possible to disable isset checks completely?
    opened by cronfy 6
  • HTML minification can break inline scripts

    HTML minification can break inline scripts

    Using this jade syntax:

      // JS code here...

    Without pretty when rendering collapses all the line breaks in the script code without intelligent consideration for semicolons. This breaks most inline scripts if you don't use semicolons, which is valid JS and an enforced coding style in many teams (see JavaScript Standard Style).

    Pug has no issues and intelligently minifies the JS inside inline scripts.

    enhancement pug-inconsistency 
    opened by jaydenseric 1
  • Boolean attribute issues

    Boolean attribute issues

    It seems Tale Jade does not render boolean attributes smart like Pug does.



    <button disabled="true"></button>
    <button disabled="false"></button>






    - $disabled = true;
    - $disabled = false;

    Both render:

    <button disabled="1"></button>

    Ideally, specifying true or false would render:

    <button disabled></button>

    In my component mixins I am resorting to the rather verbose:

    - $disabled = false;
    button(disabled=($disabled ? 'disabled' : false))

    To render:

    <button disabled="disabled"></button>

    According to the HTML5 spec, boolean attributes should only ever be valueless or contain the exact attribute to indicate true, or contain an empty string or be omitted to indicate false.

    bug pug-inconsistency 
    opened by jaydenseric 3
  • Nested mixin block content loses scope

    Nested mixin block content loses scope

    In Pug, this:

    mixin test
    - $text = 'Test text';


    <p>Test text</p>
    <p>Test text</p>

    In Tale Jade, the very same renders:

      Test text</p>

    This is a big blocker to porting my Pug templates over, not really sure how to handle it.

    opened by jaydenseric 15
  • Attribute Shortcuts

    Attribute Shortcuts

    Found it here

    Though, I don't like the system they use, since it reduces the portability of templates (You'd always need the same config file everywhere) and it can confuse people when someone uses @ for role and some @ for data-whatever.

    My approach is something similar to Aliases.

    shortcut @(role data-role)

    resulting in

    <nav class="main-nav" role="navigation" data-role="navigation"></nav>

    These shortcuts could be defined at the top of your base-layout or in another file that get's included (similar to mixins)

    opened by TorbenKoehn 0
  • 1.4.5(Aug 23, 2016)

    This patch contains a lot of bug-fixes. Please update as soon as possible.

    • Updated Symfony mb polyfill to 1.2.0
    • Addressed #100, still not satisfied with the solution (but it works well, for ternary operators at least)
    • Addressed #109, the ignored variables are now a constant Tale\Jade\Compiler\IGNORED_SCOPE_VARIABLES. Define it prior to loading Tale Jade to specify own ignored variables (separated by :)
    • Addressed #115, mixins can now be called in a circular way and get resolved correctly
    • Addressed #113, classes can now start with a dash
    • Addressed #112, block expansion now handles following classes correctly
    • Addressed #108 and improved error handling, including a re-write of most exception messages with more details
    • Add is_object check to build_value function of the Compiler namespace to remove __toString-errors
    Source code(tar.gz)
    Source code(zip)
  • 1.4.4(Jun 4, 2016)

    • Mixins now have proper scoping without $__args (Means you can also include generated templates with your own variable scope easily)
    • Some bugfixes
    Source code(tar.gz)
    Source code(zip)
  • 1.4.2(Apr 7, 2016)

    • Cleaned up dev-dependencies
    • Now using PSR2 fully over the whole project.
    • tale-config is now used in version 0.2 (PSR-2)
    • Fixed a bug with name-only attributes separated with spaces (#66)
    • HTML5-mode now doesn't self-close attributes at all (#66)
    • The lexer now prints a little piece of jade code to find errors faster
    • Fixed a bug regarding IE conditional comments and interpolation (#75)
    • Added composer.lock to prevent stuff like the reason for 1.4.1.
    • Make sure that compiler doesn't echo XML doctypes in tests when running in HHVM.
    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Feb 3, 2016)

    Added the ?-instruction ("unchecked"-operator)

    Disables automatic isset()-checks on variables for certain cases (e.g. objects with __get, but without __isset)


    p?= $someVar a(href?=$someVar)

    It can be combined with the !-escaping-instruction

    p?!= $someVar a(href?!=$someVar)

    Added !-instruction on texts to enable escaping

    Sometimes you want to escape text, e.g. when you want to display the HTML, not let it render For that all text-elements can now be prefixed with ! to enable escaping.

    Escaped texts will still support interpolation.


    h1 My example code
    pre: code!.
             $someVar = 123;
             echo $someVar;

    p! This HTML <em>here</em> will be escaped

        !| This text will also be escaped
    • Improved variable detection. Variables like $someVar["some, weird$9 key"] will also be automatically enclosed in the isset-check now
    • Fixed a bug with a trailing semicolon in variadics (#61)
    • Updated README-file to reflect latest config changes
    Source code(tar.gz)
    Source code(zip)
  • 1.3.7(Feb 1, 2016)

    • Improved interpolation. Interpolation can now be nested and many limits have been removed. Check the tests to see what's possible
    • composer.json has been cleaned up
    • tale-config is now used as a modular configuration approach through tale-* components
    Source code(tar.gz)
    Source code(zip)
  • 1.3.6(Jan 16, 2016)

    • Lexer makes less noise on spaces
    • Added ConfigurableTrait docs
    • Fixed a problem with attribute escaping (#48)
    • Fixed a tab conversion bug in parser configuration (#44)
    • Disabled xdebug in travis
    • Optimized travis.yml
    Source code(tar.gz)
    Source code(zip)
  • 1.3.5(Jan 16, 2016)

    • Fixed a bug where the extensions in the compiler were checked without the .-prefix in handleImport (#48)
    • Configuration-style now follows Tale\Jade\Util\ConfigurableTrait globally
    • Added some configuration utility methods to all objects
    • lifeTime, cachePath, indentStyle, indentWidth, extensions, mode, doctypes, filters and filterMap can now directly be set in the Renderer (No compilerOptions needed)
    Source code(tar.gz)
    Source code(zip)
  • 1.3.4(Jan 15, 2016)

    • Cleaned up tests
    • XML encoding will now be echoe'd by default in HHVM. An option echoXmlDoctype has been added to enable it manually
    • Compiler now handles doctypes correctly (Fixed #2)
    • Multiple extensions allowed via compiler's "extensions" options ("extension" has been removed) (Fixed #3)
    • .jd can now be used as an extension by default (.jade still works)
    • Some improved error handling
    • Doctype tests
    • Reworked the text-block lexing (#42)
    • Changed attribute parsing so that expressions like function calls are possible (Fixed #41)
    • Compiler will now always return Compiler-Exeptions, but will include the compiled file path (if any) in the message (Fixed #43)
    Source code(tar.gz)
    Source code(zip)
  • 1.3.2(Jan 5, 2016)

  • 1.3.1(Jan 5, 2016)

    Attributes can now be separated with spaces

    a(href='google.de' target='_blank')

    It's also possible to mix separators

    a(href='google.de' target='_blank', title='Some link title')
    Source code(tar.gz)
    Source code(zip)
  • 1.2.2(Nov 11, 2015)

    Tale Jade now has inbuilt support for common pre-processors

    You can either use them by using the filter-construct

        p {
            &.red { color: red; }
            &.blue { color: blue; }

    or by using import and import-filters or filter-mapping

    //Will automatically set the filter to "less"
    include my-less-file.less
    //will include my-less-file.less automatically
    include:less my-less-file

    The following pre-processors are now supported:


    Required Composer Package



    :markdown or :md




    Required Composer Package



    :coffeescript or :coffee




    Required Composer Package







    Required Composer Package



    :stylus or :styl




    Required Composer Package





    .sass or .scss

    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Nov 9, 2015)

    • Improved PHP-expression parsing
    $columns(subArray=['some-sub-array' => 'some-value'])

    will now correctly parse to

    <?php $columns = ['subArray' => ['some-sub-array' => 'some-value']]; ?>
    • null, false and true scalars are now correctly handled and converted to the PHP boolean/null equivalent
    • Added the possibility to single-line-comment inside attribute-blocks
    (It actually compiles to something more useful, check the PHTML output, but this is what it essentially is for)
        //data-omitted='this is omitted for now',
    Source code(tar.gz)
    Source code(zip)
  • 1.2(Nov 6, 2015)

    For-Loops are now supported

    for $i = 0; $i < 100; $i++
        p We are at #{$i}, counting to 100!

    Variables can now be directly assigned

    $i = 100
    p Here is my new i: #{$i}
    $array(key1=value1, key2=value2, key3=value3)
    $inner = ['a', 'b', 'c']
    $outer(inner=$inner, 'd', 'e', 'f)
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Nov 5, 2015)

    • dash-code is now a code-node and token, not expression anymore. Expressions stay as they are
    • Removed the possibility to have expressions on multiple lines
    • Added the possibility to do this:
    - for ($i = 0; $i < 100; $i++):
        p #{$i}
    - endfor;
    Source code(tar.gz)
    Source code(zip)
  • 1.1(Oct 10, 2015)

  • 1.0.3(Oct 9, 2015)

  • 1.0(Oct 6, 2015)

    The first release of the Tale Jade project.

    Many things have been tested correctly, some things may still provide bugs.

    We'll see how it works out.

    Source code(tar.gz)
    Source code(zip)
Awesome software made in Berlin
PHP Template Attribute Language — template engine for XSS-proof well-formed XHTML and HTML5 pages

PHPTAL - Template Attribute Language for PHP Requirements If you want to use the builtin internationalisation system (I18N), the php-gettext extension

PHPTAL 175 Dec 13, 2022
Twig, the flexible, fast, and secure template language for PHP

Twig, the flexible, fast, and secure template language for PHP Twig is a template language for PHP, released under the new BSD license (code and docum

Twig 7.7k Jan 1, 2023
Prosebot is a template-based natural language generation application

Prosebot is a template-based natural language generation application. Throughout the last years, ZOS has been developing Prosebot, alongside their collaboration with FEUP, as part of the zerozero.pt project.

Zerozero 12 Dec 15, 2022
A template abstraction prototype for PHP template engines

Schranz Templating A template abstraction prototype for PHP template engines. This project should help to find a way for a general Template Render Int

Schranz Templating 16 Dec 7, 2022
Provides TemplateView and TwoStepView using PHP as the templating language, with support for partials, sections, and helpers.

Aura View This package provides an implementation of the TemplateView and TwoStepView patterns using PHP itself as the templating language. It support

Aura for PHP 83 Jan 3, 2023
Multi target HAML (HAML for PHP, Twig, )

Multi target HAML MtHaml is a PHP implementation of the HAML language which can target multiple languages. Currently supported targets are PHP and Twi

Arnaud Le Blanc 363 Nov 21, 2022
A PHP project template with PHP 8.1, Laminas Framework and Doctrine

A PHP project template with PHP 8.1, Laminas Framework and Doctrine

Henrik Thesing 3 Mar 8, 2022
☕ Latte: the intuitive and fast template engine for those who want the most secure PHP sites.

Latte: amazing template engine for PHP Introduction Latte is a template engine for PHP which eases your work and ensures the output is protected again

Nette Foundation 898 Dec 25, 2022
The free-to-use template for your Imagehost-website made with PHP, HTML and CSS!

The free-to-use template for your Imagehost-website made with PHP, HTML and CSS! Some information before we start This repo is only code related, to a

Ilian 6 Jul 22, 2022
The free-to-use template for your Imagehost-website made with PHP, HTML and CSS!

The free-to-use template for your Imagehost-website made with PHP, HTML and CSS! Some information before we start This repo is only code related, to a

Ilian 6 Jul 22, 2022
⚡️ Simple and fastly template engine for PHP

EasyTpl ⚡️ Simple and fastly template engine for PHP Features It's simple, lightweight and fastly. No learning costs, syntax like PHP template It is s

PHPPkg 19 Dec 9, 2022
Foil brings all the flexibility and power of modern template engines to native PHP templates

Foil brings all the flexibility and power of modern template engines to native PHP templates. Write simple, clean and concise templates with nothing more than PHP.

Foil PHP 167 Dec 3, 2022
PHP template engine for native PHP templates

FOIL PHP template engine, for PHP templates. Foil brings all the flexibility and power of modern template engines to native PHP templates. Write simpl

Foil PHP 167 Dec 3, 2022
A SilverStripe Module with template methods to quickly make use of FocusPoint, LazySizes, and Object-fit

LazyFocusFit A SilverStripe module with template methods to quickly make use of FocusPoint, LazySizes and object-fit. Requirements PHP FocusPoint JS/C

Evans Hunt 9 Nov 4, 2022
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.

Smarty 3 template engine smarty.net Documentation For documentation see www.smarty.net/docs/en/ Requirements Smarty can be run with PHP 5.2 to PHP 7.4

Smarty PHP Template Engine 2.1k Jan 1, 2023
Native PHP template system

Plates Plates is a native PHP template system that's fast, easy to use and easy to extend. It's inspired by the excellent Twig template engine and str

The League of Extraordinary Packages 1.3k Jan 7, 2023
View template engine of PHP extracted from Laravel

Blade 【简体中文】 This is a view templating engine which is extracted from Laravel. It's independent without relying on Laravel's Container or any others.

刘小乐 143 Dec 13, 2022
A ready-to-use Model View Controller template in PHP

PHP-MVC-Template A ready-to-use Model View Controller template in PHP Use this repo as a template! (Or clone it) Start to configure your MVC file Afte

Loule | Louis 20 Dec 26, 2022
Provides a GitHub repository template for a PHP package, using GitHub actions.

php-package-template Installation ?? This is a great place for showing how to install the package, see below: Run $ composer require ergebnis/php-pack

null 280 Dec 27, 2022