<commit_before>TruncateHtml
============

truncate_html is a Rails helper plugin that [cuts off](http://www.youtube.com/watch?v=6XG4DIOA7nU) a string of HTML and takes care of closing any lingering unclosed open tags. There are many possible solutions to this. This plugin does not have any dependencies, and does all it's work via regular expressions.

The API is very similar to Rails' own truncate method. 


Example
-------
<code>

`some_html = '<ul><li><a href="http://whatever">This is a link</a></li></ul>'`

`truncate_html(some_html, :length => 5, :omission => '...(continued)')`

`  => <ul><li><a href="http://whatever">This is...(continued)</a></li></ul>`

</code>

A few notes:

* It will truncate on a word boundary.
* The default options are:
  * :length => 100
  * :omission => '...'

Installation
------------

<code>script/plugin install git://github.com/hgimenez/truncate_html.git</code>

Testing
-------

The plugin is tested using rspec. [Install it](http://wiki.github.com/dchelimsky/rspec/rails) on your app if you wish to run the tests.

Copyright (c) 2009 <NAME>, released under the MIT license<commit_msg>Formatting Readme, this time four spaces for block quotes<commit_after>TruncateHtml
============

truncate_html is a Rails helper plugin that [cuts off](http://www.youtube.com/watch?v=6XG4DIOA7nU) a string of HTML and takes care of closing any lingering unclosed open tags. There are many possible solutions to this. This plugin does not have any dependencies, and does all it's work via regular expressions.

The API is very similar to Rails' own truncate method. 


Example
-------

    some_html = '<ul><li><a href="http://whatever">This is a link</a></li></ul>'

    truncate_html(some_html, :length => 5, :omission => '...(continued)')

      => <ul><li><a href="http://whatever">This is...(continued)</a></li></ul>


A few notes:

* It will truncate on a word boundary.
* The default options are:
  * :length => 100
  * :omission => '...'

Installation
------------

<code>script/plugin install git://github.com/hgimenez/truncate_html.git</code>

Testing
-------

The plugin is tested using rspec. [Install it](http://wiki.github.com/dchelimsky/rspec/rails) on your app if you wish to run the tests.

Copyright (c) 2009 <NAME>, released under the MIT license
{'fraction_non_alphanumeric': 0.16136066288704753, 'fraction_numerical': 0.009594417793283908, 'mean_word_length': 3.779166666666667, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '56995', 'n_tokens_mistral': 747, 'n_tokens_neox': 696, 'n_words': 249}