2017 © Pedro Peláez
 

library texy-nette

Texy integration for Nette.

image

nepada/texy-nette

Texy integration for Nette.

  • Friday, July 27, 2018
  • by xificurk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 960 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 19 % Grown

The README.md

Texy integration for Nette

Build Status Coverage Status Downloads this Month Latest stable, (*1)

Installation

Via Composer:, (*2)

$ composer require nepada/texy-nette

Register the extension in config.neon:, (*3)

extensions:
    texy: Nepada\Bridges\TexyDI\TexyExtension

Usage

Configuration

This extension contains simple Texy factory that only creates new instance of Texy\Texy., (*4)

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

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)., (*6)

In templates

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

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



{texyLine barMode}Whatever...{/texyLine} , (*8)

Alternatively, you can use one of 3 filters to achieve similar result:, (*9)

  • |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:, (*10)

php $multiplier->processBlock($text, 'myMode'); $texy = $multiplier->getTexy('myMode');, (*11)

The Versions