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

Add support for lists in from html plugin #249

Merged
merged 1 commit into from
May 11, 2014
Merged

Add support for lists in from html plugin #249

merged 1 commit into from
May 11, 2014

Conversation

danielhusar
Copy link
Contributor

Hi Guys,

I tried to add support for OL and UL lists in from_html plugin.
I have few issues there, the biggest one is that I don't know how to add bullet point so there is dash for now.
Another one si with spacing from bottom on lists which is probably not done very clever way :)

Feel free to ignore or change anything here as its not perfect, but I saw few people demanding support for lists so it might help someone.

@danielhusar
Copy link
Contributor Author

Actually I figured out the bullets :)

@danielhusar
Copy link
Contributor Author

#140 related

@diegocr
Copy link
Collaborator

diegocr commented May 7, 2014

Thanks. Can you post some screenshoot on how it looks or some live example?

@danielhusar
Copy link
Contributor Author

Hi,

sure I will add live demo tommorow.

Thanks.

@danielhusar
Copy link
Contributor Author

Hi, heres the demo:

http:https://jsfiddle.net/RbdF8/2/

@BatJan
Copy link

BatJan commented May 8, 2014

This is exactly what I need for a project I'm currently working on.

I realise that this might not be merged etc. straight away...so All I need to know is how I can build and run the script based on your fork @danielhusar ? :) Can't seem to find some documentation about that...not sure if it's just a matter of forking and then running the build.sh?

@danielhusar
Copy link
Contributor Author

Hi,

You can fork my fork and run build.sh and it should work :)

You can also pick up jsPDF directly from the demo: https://dl.dropboxusercontent.com/u/11755646/jspdf.js

Or if you want to do it manually all you need to do is replace DrillForContent function with function from the file above, and var listCount = 1; variable thats above it.

@rx4hvn
Copy link

rx4hvn commented May 8, 2014

Hi there,

I was also facing the same issue, this JS also fixed the multi-page generation.
But, I am unable to insert line breaks. Please help.

Thanks in advance.

@BatJan
Copy link

BatJan commented May 8, 2014

@danielhusar Thanks! Did not notice the "external script" stuff on the jsfiddle site.

Got it and seems to be working. However it seems I have an issue with ordered lists not showing any numbers. But that may be something in my end. Will report back tomorrow.

Thanks again.

@diegocr
Copy link
Collaborator

diegocr commented May 8, 2014

Nice work Daniel, only problem i've found is that you use static-size bullets, so they look wrong depending the font size used.

Example: http:https://jsfiddle.net/RbdF8/3/

Ideally you should calculate their size from the line-height and place them in the middle of the line.

@danielhusar
Copy link
Contributor Author

Hi,
yeah you are right, I will fix that.

Thanks.

@danielhusar
Copy link
Contributor Author

Hi,

I made some changes and bullets should be centered now.
You can check your demo.
(just clear cached file from dropbox)

@danielhusar
Copy link
Contributor Author

There is however still issue when line height is bigger than font size.

@danielhusar
Copy link
Contributor Author

Most of the line heights will be now fine, but if there will be some big difference between them like font size: 20px; line-height: 80px; bullet will be outlined a little.

Is there any pattern between those two? Because text doesn't look like to me its in the middle of the line in the pdf.

@diegocr
Copy link
Collaborator

diegocr commented May 10, 2014

Thanks Daniel.

I think i can see what you mean....

Chrome:
14191043532

Firefox & Adobe Reader:
14191043612

Well, at least it looks better now, so... Meh, i can take a look at it locally once merged.

Feel free to add yourself to the header/copyright, and also it'll be great if you squash all your commits into a single one, then we can proceed to merge.

commit 2866f2c
Author: Daniel <[email protected]>
Date:   Sun May 11 17:53:29 2014 +0100

    Refactor list bullets

commit d052406
Author: Daniel Husar <[email protected]>
Date:   Fri May 9 16:56:32 2014 +0100

    Fix line height issues

commit 20fd751
Author: Daniel Husar <[email protected]>
Date:   Fri May 9 15:25:16 2014 +0100

    Auto center  bullets in lists.

commit 16750b7
Author: Daniel Husar <[email protected]>
Date:   Thu May 8 09:35:41 2014 +0100

    Bottom list spacing

commit 3b4bfa5
Author: Daniel Husar <[email protected]>
Date:   Thu May 8 09:16:51 2014 +0100

    refactor spacing

commit 1d47f08
Author: Daniel Husar <[email protected]>
Date:   Wed May 7 17:30:50 2014 +0100

    singlequotes

commit e22ae61
Author: Daniel Husar <[email protected]>
Date:   Wed May 7 17:19:34 2014 +0100

    add support for bullets

commit 81db7cd
Author: Daniel Husar <[email protected]>
Date:   Wed May 7 16:36:54 2014 +0100

    add support for lists in html parser
@danielhusar
Copy link
Contributor Author

Hi,

yep no worries.
I did a little refactoring there should be now a little better.

@diegocr
Copy link
Collaborator

diegocr commented May 11, 2014

Nice, why these changes to libs/polyfill.js though?

@diegocr
Copy link
Collaborator

diegocr commented May 11, 2014

Ah, i suspect there were mixed Unix and Windows CRLFs. So, meh. Merging...

diegocr added a commit that referenced this pull request May 11, 2014
Add support for lists in from html plugin, fixes #140
@diegocr diegocr merged commit 7c555c7 into parallax:master May 11, 2014
@danielhusar
Copy link
Contributor Author

Hi,

thanks a lot.
I included polyfill for inArray method as its used there somewhere and IE8 was breaking.

@diegocr
Copy link
Collaborator

diegocr commented May 11, 2014

Good, didn't noticed the inclusion of inArray, rather i was referring to:

14191119371

@BatJan
Copy link

BatJan commented May 12, 2014

Really nice to seee this has been merged into the core. Good work! :)

Just wondering what it would take to make it possible to allow stuff like , , , etc. render nicely if you for some reason need to highlight something in a list like

  1. Manchester City
  2. Liverpool
  3. Chelsea

the above will return "Manchester City" in bold but no list-number.

How would one do that and still ensure that the list is still showing the bullets?

@vbahinwillit
Copy link

Hi,

Thanks for adding support for lists!!! I hate to be greedy but are embedded lists supported? Ex.

  • item 1
    • item 1a
  • item 2

@Joyrex
Copy link

Joyrex commented Apr 4, 2016

Weirdly enough, this version of the plugin (the one referenced and linked in the Fiddle) supports bulleted lists, but in the current version, the bullet is bottom-aligned to the current LI tag it belongs to when the text exceeds two lines - why would an older version support a feature the newer version no longer does?

I've tested my content in the Fiddle above, and even downloaded the version in the fiddle and tested against the content, and it aligns correctly, but going back to the current version (1.2.61), the bullets are bottom-aligned to the list-item block of text (again, when the text exceeds two lines).

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

Successfully merging this pull request may close these issues.

None yet

6 participants