2017 © Pedro Peláez
 

library twig-ansi-extension

A twig extension for sensiolabs/ansi-to-html

image

beryllium/twig-ansi-extension

A twig extension for sensiolabs/ansi-to-html

  • Saturday, March 23, 2013
  • by beryllium
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

ANSI to HTML5 Converter Extension for Twig

Inspired by the sensiolabs/ansi-to-html release, I wanted to create a quick Twig extension for rendering ANSI as HTML inside Twig templates., (*1)

Installation

Add the requirement to your composer.json (it should fetch ansi-to-html automatically):, (*2)

    {
      "require": {
        "beryllium/twig-ansi-extension": "dev-master"
      }
    }

Usage

First, get sensiolabs/ansi-to-html configured the way you like it. Then you can do this:, (*3)

Default usage:, (*4)

    $twig->addExtension(new Beryllium\TwigAnsiExtension\TwigAnsiExtension($ansi));

Optional "themed" usage:, (*5)

    $twig->addExtension(new Beryllium\TwigAnsiExtension\TwigAnsiExtension($ansi,$theme));

And now you can use it inside twig, like so:, (*6)

    {{ 'my_ansi_string'|ansi|raw }}

If you opted to add the theme, you should be able to output the style CSS like so:, (*7)

    {{ get_ansi_css()|raw }}

Current Status

At the moment this is just a quick prototype, I haven't even tested the theme support. In my local environment, I'm using the "colordiff" system utility to generate sample ANSI output. Other examples of ANSI output include PHPUnit with colors enabled, and especially PHPUnit results with NyanCat output enabled (although I don't think streaming would work)., (*8)

The Versions

23/03 2013

dev-master

9999999-dev

A twig extension for sensiolabs/ansi-to-html

  Sources   Download

MIT

The Requires

 

twig extension ansi

23/03 2013

v1.0.0

1.0.0.0

A twig extension for sensiolabs/ansi-to-html

  Sources   Download

MIT

The Requires

 

twig extension ansi