Skip to main content

Python module which help to cut html string by keeping html tags as it is

Project description

It is easy to extract an excerpt of a text string with a given length limit. But if you want to extract an excerpt from HTML, the tags that may exist in the text string make it more complicated.

This module provides a solution to extract excerpts from HTML documents with a given text length limit without counting the length of any HTML tags.

This package is used to cut the string which is having html tags. It does not count the html tags, it just count the string inside tags and keeps the tags as it is.

ex: If the string is “welcome to <b>Python World</b> <br/> Python is bla”. and If we want to cut the string of 16 charaters then output will be “welcome to <b>Python</b>”.

Here while cutting the string it keeps the tags for the cutting string and skip the rest and without distorbing the div structure.

USAGE1:

obj = HtmlCutString(“welcome to <b>Python World</b> <br/> Python is”,16)

newCutString = obj.cut()

USAGE2:

newCutString = cutHtmlString(“welcome to <b>Python World</b> <br/> Python is”,16)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

htmlcutstring-1.1.zip (2.1 kB view details)

Uploaded Source

htmlcutstring-1.1.tar.gz (1.7 kB view details)

Uploaded Source

File details

Details for the file htmlcutstring-1.1.zip.

File metadata

  • Download URL: htmlcutstring-1.1.zip
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for htmlcutstring-1.1.zip
Algorithm Hash digest
SHA256 87366e50244f6640724796ecff5609b25ac5daf99737a7f5f5f860c1d97c5671
MD5 f93433ca1cdc1d1fd99fe396aecce599
BLAKE2b-256 b490db90712b6e1fda861eab2d1f1dd63f318b096895ea0a87e4c623f8440e80

See more details on using hashes here.

File details

Details for the file htmlcutstring-1.1.tar.gz.

File metadata

  • Download URL: htmlcutstring-1.1.tar.gz
  • Upload date:
  • Size: 1.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for htmlcutstring-1.1.tar.gz
Algorithm Hash digest
SHA256 55cfb8adbbd4ba84f504654a3757fbf8409376615761ff8cff3c84d829b9894d
MD5 3f80d8b604f432182e4a47cf6e907eb8
BLAKE2b-256 2e090fe7c8efb55e331aff6407c3929f772157704046adf8b9b13728da4a8c2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page