Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body width not working with lists #85

Closed
brunofjesus opened this issue Jul 1, 2015 · 11 comments
Closed

Body width not working with lists #85

brunofjesus opened this issue Jul 1, 2015 · 11 comments

Comments

@brunofjesus
Copy link

I use the body_width property to limit the width of the text but it seems not to be working for lists.

@Alir3z4
Copy link
Owner

Alir3z4 commented Jul 1, 2015

@strang3quark Do you think #84 will be a good way to fix this ?

@theSage21
Copy link
Collaborator

@strang3quark Right. Will be working on this. Is this what you are experiencing?

<ul>
    <li>
        <ul>
            <li>
                <ul>
                    <li>asdgsdfdsfasdfsadfasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasfdsglkjsdlgjsdljvld</li>
                    <li>asdgsdfdsfasdfsadfasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasfdsglkjsdlgjsdljvld</li>
                    <li>asdgsdfdsfasdfsadfasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasfdsglkjsdlgjsdljvld</li>
                    <li>asdgsdfdsfasdfsadfasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasfdsglkjsdlgjsdljvld</li>
                </ul>
            aqweqwtrqwtqwrqwr</li>
            <li>qweqwcklmlcmkkajsdkljlkwmqcqlmcasjdfaslnfdn v,mancmaslkdaldjqwidnl asmldk alsdamskdaskdaslkfjasklfaqweqwtrqwtqwrqwr</li>
            <li>qweqwcklmlcmkkajsdkljlkwmqcqlmcasjdfaslnfdn v,mancmaslkdaldjqwidnl asmldk alsdamskdaskdaslkfjasklfaqweqwtrqwtqwrqwr</li>
            <li>qweqwcklmlcmkkajsdkljlkwmqcqlmcasjdfaslnfdn v,mancmaslkdaldjqwidnl asmldk alsdamskdaskdaslkfjasklfaqweqwtrqwtqwrqwr</li>
        </ul>
    </li>
    <li>poqwoirpoqwpcqpasdoiaspfjanfladsnclqeiofjqjdfklqklcmaklsmckljzklcaklsmdlkasdklajdklwamcklqwmclacm</li>
    <li>poqwoirpoqwpcqpasdoiaspfjanfladsnclqeiofjqjdfklqklcmaklsmckljzklcaklsmdlkasdklajdklwamcklqwmclacm</li>
    <li>poqwoirpoqwpcqpasdoiaspfjanfladsnclqeiofjqjdfklqklcmaklsmckljzklcaklsmdlkasdklajdklwamcklqwmclacm</li>
    <li>poqwoirpoqwpcqpasdoiaspfjanfladsnclqeiofjqjdfklqklcmaklsmckljzklcaklsmdlkasdklajdklwamcklqwmclacm</li>
    <li>poqwoirpoqwpcqpasdoiaspfjanfladsnclqeiofjqjdfklqklcmaklsmckljzklcaklsmdlkasdklajdklwamcklqwmclacm</li>
</ul>

This text spills over the body width specified. correct?

@brunofjesus
Copy link
Author

@theSage21 yes, but it appears that it's not only related with lists.

This is the code I'm using:

  def htmlToText(self,content,cols, showImgTags = False):
        parser = html2text.HTML2Text(bodywidth=cols)                    
        parser.images_with_size = showImgTags
        #parser.images_to_alt = not(showImgTags)
        parser.inline_links = False
        return parser.handle(content)

There is a screenshot:
2015-07-01_02 54 44

@theSage21
Copy link
Collaborator

@strang3quark Could you put the actual html here? I do not want to type all of that out. 😄

@brunofjesus
Copy link
Author

@theSage21
Copy link
Collaborator

@strang3quark I do not know how lists should be formatted when wrapped. Possibly something like this? Constant indent. As for the pre tags I think the wrapping should be avoided.

*  first element which was too long to fit
   on one line.
*  second element which was too long to fit
   on one line.

@theSage21
Copy link
Collaborator

@strang3quark List wrapping is specifically suspended by this code. @Alir3z4 Should we change? Changing this will break a lot of people's code.

@Alir3z4
Copy link
Owner

Alir3z4 commented Jul 1, 2015

@theSage21 Thanks for doing a good inspection.
wrapping should not be done on lists. Please don't change the code and it let it behave as before.

@theSage21
Copy link
Collaborator

@strang3quark as a fix for your problem you can comment out the said lines. skipwrap function in utils.py controls what to skip. Commenting out parts of the code should help you out.

@brunofjesus
Copy link
Author

@theSage21 Ok, thanks.

@theSage21
Copy link
Collaborator

@Alir3z4 Close the issue? Is there something I missed?

@Alir3z4 Alir3z4 closed this as completed Oct 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants