Popularity
3.8
Growing
Activity
1.6
-
28
1
3

Monthly Downloads: 407
Programming language: Elixir
License: Apache License 2.0
Tags: Text And Numbers    
Latest version: v2.0

curtail alternatives and similar packages

Based on the "Text and Numbers" category.
Alternatively, view curtail alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of curtail or a related project?

Add another 'Text and Numbers' Package

README

Curtail

Build Status

HTML tag safe string truncation.

Port of the html_truncate gem.

Installation

def deps do
  [ {:curtail, "~> 1.0"} ]
end

Usage

Options

* length (default: 100)
* omission (default: "...")
* word_boundary (default: "~r/\S/")
* break_token (default: nil)

Truncate using default options:

  iex> Curtail.truncate("<p>Truncate me!</p>")
  "<p>Truncate me!</p>"

Truncate with custom length:

  iex> Curtail.truncate("<p>Truncate me!</p>", length: 12)
  "<p>Truncate...</p>"

Truncate without omission string:

iex> Curtail.truncate("<p>Truncate me!</p>", omission: "", length: 8)
"<p>Truncate</p>"

Truncate with custom word_boundary:

iex> Curtail.truncate("<p>Truncate. Me!</p>", word_boundary: ~r/\S[\.]/, length: 12, omission: "")
"<p>Truncate.</p>"

Truncate without word boundary:

iex> Curtail.truncate("<p>Truncate me</p>", word_boundary: false, length: 7)
"<p>Trun...</p>"

Truncate with custom break_token:

iex> Curtail.truncate("<p>This should be truncated here<break_here>!!</p>", break_token: "<break_here>")
"<p>This should be truncated here</p>"

License

Released under MIT License.


*Note that all licence references and agreements mentioned in the curtail README section above are relevant to that project's source code only.