keeganstreet / element-finder

Find in Files with CSS selectors
http://keegan.st/2012/06/03/find-in-files-with-css-selectors/
119 stars 8 forks source link

Normalize whitespace, eliminate new lines #6

Closed ghost closed 8 years ago

ghost commented 11 years ago

Another interesting feature would be to normalize whitespace and eliminate new line characters from content. For example:

<td class="data">This   is     a     comment
that a user made.</td>

By normalizing whitespace and eliminating new lines, you could obtain cleaner data:

<td class="data">This is a comment that a user made.</td>

The content of the element can then be extracted:

This is a comment that a user made.

For example:

cat filename.html | elfinder --normalize-whitespace --no-eol --extract-content --selector "td.data"