jasir/clipper

There is no license information available for the latest version (dev-master) of this package.

Clips out marked parts from textfile

dev-master 2015-03-21 22:13 UTC

This package is not auto-updated.

Last update: 2024-04-13 11:51:12 UTC


README

Clipper is a small utility to take a text and clip regions marked with your own marks. Use it for example to clip only relevant parts from your html pages to generate pdf. Marks can be nested

$text = <<<EOF
<html>
<!--start-->
<body>
<!--end-->
<ul class="menu">
  <li> Wow
</ul>
<!--start-->
<p>LoremIpsum</p>
<!--end-->
<footer>
</footer>
<!--start-->
</body>
<!--end-->
</html>
EOF;

Clipping text between marks

$clipper = new Clipper('<!--start-->', '<!--end-->');
$result = $cliper->clip($text)

# $result contains <body><p>LoremIpsum</p>

Clipping text not between marks

$result = $clipper->clipExclued($text);

#result contains <html><body><ul class="menu"><li>Wow</ul><footer></footer></html>