Componette

Componette

nepada

nepada / texy-nette v5.0.1

Texy integration for Nette.

download-cloud-line composer require nepada/texy-nette

Texy integration for Nette

Build Status Coverage Status Downloads this Month Latest stable

Installation

Via Composer:

$ composer require nepada/texy-nette

Register the extension in config.neon:

extensions:
    texy: Nepada\Bridges\TexyDI\TexyExtension

Usage

Configuration

This extension contains simple Texy factory that only creates new instance of Texy\Texy.

Usually you will want to define your own factory by implementing Nepada\Texy\TexyFactory, often more than one.

texy:
    factories:
        foo: @fooTexyFactory
        bar: @barTexyFactory

    defaultMode: foo

This example adds two custom factories. Note the names foo and bar - we call these Texy "modes". In different parts of your application you might need to use different mode (i.e. differently configured instance of Texy).

In templates

There are 2 new tags for processing blocks and single lines, both with possibility to specify a custom mode:

{texy fooMode}
    - one
    - two
{/texy}

<p>
    {texyLine barMode}Whatever...{/texyLine}
</p>

Alternatively, you can use one of 3 filters to achieve similar result:

  • |texy:customMode calls $texyMultiplier->processBlock()
  • |texyLine:customMode calls $texyMultiplier->processLine()
  • |texyTypo:customMode calls $texyMultiplier->processTypo()

In presenters and other controls

The preferred way is to inject Nepada\Texy\TexyMultiplier instance wherever you need it, and either use it directly or pull out desired Texy instance, e.g:

$multiplier->processBlock($text, 'myMode');
$texy = $multiplier->getTexy('myMode');
  • v5.0.1 5.0.1

    • PHP 8.2 compatibility
  • v5.0.0 5.0.0

    • Removed deprecations from 4.x
    • Update to Latte 3
    • Automatically outdent texy blocks
    • Add new Latte tags {texy} and {texyLine}
    • Strictly restrict |texyTypo filter to text content (possible BC break)
    • Disallow overriding of already defined factory by TexyMultiplier::addFactory() (possible BC break)
    • Mark most classes final (possible BC break)
  • v4.3.0 4.3.0

    • Dropped PHP 7.4 support
    • Deprecate TexyMultiplier::process(), replaced by more explicit processBlock() and processLine()
    • Deprecate undocumented $singleLine parameter of |texy filter
    • Add possibility to specify mode in TexyMultiplier::process*() and corresponding Latte filters
    • Deprecate {texyMode} macro
    • Deprecate changing the internal mode of TexyMultiplier
  • v4.2.0 4.2.0

    • PHP 8.1 compatibility.
  • v4.1.0 4.1.0

    • PHP 8.0 compatibility.
    • Requires Latte 2.7 or greater.
  • v4.0.0 4.0.0

    • Renamed TexyFactory -> DefaultTexyFactory, ITexyFactory -> TexyFactory (BC break)
  • v3.6.0 3.6.0

    • Requires Texy 3.1.
    • Texy Latte filters: dropped support for XML/XHTML input and output, only HTML or text is supported (possible BC break).
    • TexyMultiplier - output mode getter removed (possible BC break).
  • v3.5.0 3.5.0

    • Requires PHP >=7.4.
    • Uses native property typehints.
  • v3.4.0 3.4.0

    • Requires PHP >=7.2.
    • PHP 7.4 compatibility.
    • TexyModeMacro marked final (possible BC break).
  • v3.3.0 3.3.0

    • Requires Nette 3.0 (Nette 2.4 support was dropped).
    • Requires Texy 3.0 (Texy 2.8 support was dropped).
  • v3.2.0 3.2.0

    • Nette 3 compatibility.
  • v3.1.0 3.1.0

    • Fixed compatibility with Latte 2.5
    • Support Texy 3
    • CI improvements
  • v3.0.0 3.0.0

    • Improved type safety.
    • Refactored exception hierarchy (drop marker interface, use standard exceptions instead of custom InvalidStateException) - unlikely, but possible BC break.
  • v2.0.2 2.0.2

    • Code style improvements.
  • v2.0.1 2.0.1

    • PHP 7.2 compatibility.
  • v2.0.0 2.0.0

    • Requires PHP 7.1.
    • Uses declare(strict_types = 1).
    • Uses scalar and return type hints.
    • Compatible with PHP 7.2.
  • v1.1.1 1.1.1

    • Code style improvements.
  • v1.1.0 1.1.0

    • Requires Nette 2.4.
    • Compatible with Latte 2.4.
  • v1.0.4 1.0.4

    • Code style improvements.
  • v1.0.3 1.0.3

    • Added TexyMultiplier::getOutputMode().
  • v1.0.2 1.0.2

    • 1.0.x conflicts with Latte >=2.4.
  • v1.0.1 1.0.1

    • Forward compatibility with Latte 2.4.
  • v1.0.0 1.0.0

    • Initial release.
bar-chart-fill

Statistics

download-cloud-fill
6792
star-fill
3
bug-fill
0
flashlight-fill
28d
price-tag-2-line

Badges

guide-fill

Dependencies

php (>=7.1.0)
nette/utils (^2.4@dev || ^3.0@dev)
texy/texy (^2.8@dev || ^3.0@dev)
Componette Componette felix@nette.org