2017 © Pedro Peláez
 

library twig-htmlstrip

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

image

purplebooth/twig-htmlstrip

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  • Saturday, December 2, 2017
  • by PurpleBooth
  • Repository
  • 2 Watchers
  • 2 Stars
  • 3,122 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 24 % Grown

The README.md

twig-htmlstrip

Filter for Twig to convert a small subset of html into something reasonable you can put in plain text email, or SMS., (*1)

Build Status Scrutinizer Code Quality Coverage Status Dependency Status Latest Stable Version Total Downloads License, (*2)

How To Use

Add the dependency to your composer.json, (*3)

php composer.phar require purplebooth/twig-htmlstrip:^1.0.0

Add a service which points to the class, and tag it with the twig.extension tag., (*4)

# src/Acme/DemoBundle/Resources/config/services.yml
services:
    purplebooth.twig.html_stripper_extension:
        class: PurpleBooth\HtmlStripperExtension
        tags:
            - { name: twig.extension }

And use it, (*5)

{{ yourhtml|html_strip }}

Examples

Input:, (*6)

<p>Hello, world.</p>

Output:, (*7)

Hello, world.

Input:, (*8)

<a href="http://pleasestopbeingsad.tumblr.com/">Quote source</a>

Output:, (*9)

Quote source (http://pleasestopbeingsad.tumblr.com/)

Input:, (*10)

<ul>
    <li>You're a good person</li>
    <li>Don't be too hard on yourself</li>
    <li>Enjoy the little things</li>
</ul>

Output:, (*11)

* You're a good person
* Don't be too hard on yourself
* Enjoy the little things

Input:, (*12)

<div>Tomorrow will be better.</div>
You're doing your best, and I'm proud of you.

Output:, (*13)

Tomorrow will be better.


You're doing your best, and I'm proud of you.

Input:, (*14)

<blockquote>It's always good to read a good book.</blockquote>
You are not here, <i>but I am thinking of you.</i>

Output:, (*15)

It's always good to read a good book. You are not here, but I am thinking of you.

Input:, (*16)

<div>
    <p>If she wants to <i>dance</i> and drink all night.</p>
    <ul>
        <li>Well theres no one that can stop her</li>
        <li>Shes going until the house lights come up or her stomach spills on to the floor</li>
        <li>This night is gonna end when we're damn well ready for it to be over</li>
        <li>Worked all week long now the music is playing on our time</li>
    </ul>
    <div><div>Hello</div><div>Fin.</div></div>
</div>

Output, (*17)

If she wants to dance and drink all night.

* Well theres no one that can stop her
* Shes going until the house lights come up or her stomach spills on to the floor
* This night is gonna end when we're damn well ready for it to be over
* Worked all week long now the music is playing on our time


Hello


Fin.

Versioning

We use semver. See the releases for a changelog and versions, (*18)

The Versions

02/12 2017

dev-master

9999999-dev

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Alice Thompson

21/07 2017

v1.2.0

1.2.0.0

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Alice Thompson

04/11 2016

dev-PurpleBooth-patch-1

dev-PurpleBooth-patch-1

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Alice Thompson

04/11 2016

1.1.2

1.1.2.0

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Alice Thompson

24/07 2016

v1.1.1

1.1.1.0

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Alice Thompson

24/07 2016

v1.1.0

1.1.0.0

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Alice Thompson

24/07 2016

v1.0.2

1.0.2.0

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Alice Thompson

05/02 2014

v1.0.1

1.0.1.0

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Thompson

05/02 2014

v1.0.0

1.0.0.0

Strip the html from some

  Sources   Download

MIT

The Requires

 

The Development Requires

by Billie Thompson