Giter VIP home page Giter VIP logo

htmltruncate.py's People

Contributors

eentzel avatar glazz87 avatar mortbauer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

htmltruncate.py's Issues

Installing from pip

I was wondering if you could package this project onto PyPI so we could just do pip install htmltruncate. I think it would be nicer than having to copy paste the files manually or set up a git submodule.

False UnbalancedError

You wrote great module thanks you!
But it seems little bug.

>>> htmltruncate.truncate('фывафдывфдлсв<br><strong>фыварфылвр </strong><br>ываыва<br><br><em>ываываыавфв</em><br><br><br><strong>вфвфывфыв<br><br><img class="img-responsive" src="/files/076e3caed758a1c18c91a0e9cae3368f.jpg"><br><br>fdfgdfg<br>sdfsdfsf<em>sdfsfdsfs
df</em></strong><br><ol><li><strong><em>aasd</em></strong></li></ol>', 50)
'фывафдывфдлсв<br><strong>фыварфылвр\xa0</strong><br>ываыва<br><br><em>ываываыавфв</em><br><br><br><strong>вфвфывфыв</strong></br></br></br></br></br></br></br>'
>>>
>>> htmltruncate.truncate('фывафдывфдлсв<br><strong>фыварфылвр </strong><br>ываыва<br><br><em>ываываыавфв</em><br><br><br><strong>вфвфывфыв<br><br><img class="img-responsive" src="/files/076e3caed758a1c18c91a0e9cae3368f.jpg"><br><br>fdfgdfg<br>sdfsdfsf<em>sdfsfdsfs
df</em></strong><br><ol><li><strong><em>aasd</em></strong></li></ol>', 200)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\GitLab\personal\exp_14\app\htmltruncate.py", line 143, in truncate
    raise UnbalancedError( tok.as_string() )
htmltruncate.UnbalancedError: </strong>
>>>

If I replace <img> tag with same but closing <img /> then the problem disappears.

Add attribution at the beginning of htmltruncate.py

I really just wanted to say thanks. Your code save me hours. But I would also suggest that you add some attributation information at the beginning of htmltruncate.py (the source file) as I just copied the file into
my project and I'd like to give credit where credit is due.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.