zzyengineer / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

PrettyPrintOne(...) removing line breaks. #158

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use PrettyPrintOne() on a code block.

Given a multi-line code block, prettyPrintOne(...) colorizes the code correctly 
but seems to be removing the line breaks, so all the code ends up on a single 
line.  The regular prettyPrint() acts as expected.

What version are you using?  On what browser?
2011-06-01

Original issue reported on code.google.com by mjs7...@gmail.com on 12 Jun 2011 at 4:33

GoogleCodeExporter commented 9 years ago
After downgrading to version 2009-12-03, prettyPrintOne() adds line breaks as 
expected.

Original comment by mjs7...@gmail.com on 12 Jun 2011 at 4:43

GoogleCodeExporter commented 9 years ago
Same issues here, on all webkit browsers. Same solution as well

Original comment by eric%her...@gtempaccount.com on 19 Jun 2011 at 9:48

GoogleCodeExporter commented 9 years ago
Can I assume you're having the problem on recent stable versions of Safari and 
Chrome?

Can you paste the call to prettyPrintOne that you're using?  Are you using the 
numberLines option?

Original comment by mikesamuel@gmail.com on 21 Jun 2011 at 11:01

GoogleCodeExporter commented 9 years ago
I'm having this same issue. It seems like the version from 2009-12-03 was 
assuming whitespace if the tagName == PRE. The current version seems to just 
rely on the computed style. 2009-12-03 has the following useful comment on line 
302: "Firefox makes a best guess if node is disconnected whereas Safari returns 
the empty string."

Original comment by nchap...@gmail.com on 30 Jul 2011 at 5:26

GoogleCodeExporter commented 9 years ago
I'm having the same issue. Ive tested on webkit browsers and its removing line 
breaks on me when I use prettyPrintOne(). Did anyone find a fix for this yet?

Original comment by codeoffi...@gmail.com on 13 Sep 2011 at 7:43

GoogleCodeExporter commented 9 years ago
Also having the same issue and would very much like a fix!

Original comment by karl.kul...@gmail.com on 17 Nov 2011 at 12:04

GoogleCodeExporter commented 9 years ago
The same problem. Solved by downgrading to version december 2009.

Original comment by Zilderm...@gmail.com on 1 Feb 2012 at 9:43

GoogleCodeExporter commented 9 years ago
This should be fixed by removing the reliance on getComputedStyle (detached 
elements don't get styles) or by temporarily adding the 'container' to the 
document.body in 'prettyPrintOne'

Original comment by jaffathe...@gmail.com on 19 Feb 2012 at 2:55

GoogleCodeExporter commented 9 years ago
Here's a patch that fixes the issue by adding the container temporarily to the 
dom

Original comment by jaffathe...@gmail.com on 19 Feb 2012 at 3:05

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was fixed recently by 
http://code.google.com/p/google-code-prettify/source/detail?r=201

Original comment by mikesamuel@gmail.com on 30 Mar 2012 at 6:40

GoogleCodeExporter commented 9 years ago
It still doesn't work. orettyPrintOne removes line breaks not matter what. 
Using Chrome 19.0.1084.56 m.

Original comment by hkpa...@gmail.com on 28 Jun 2012 at 5:08

GoogleCodeExporter commented 9 years ago
Ok. So its fixed in r201 (I think looking at the Url) but the latest download 
is built off r187. That lead me to believe it wasn't working. Manually grabbing 
the latest source seems to have fixed this.

Original comment by hkpa...@gmail.com on 28 Jun 2012 at 5:34

GoogleCodeExporter commented 9 years ago
I will do a release shortly.  

Original comment by mikesamuel@gmail.com on 29 Jun 2012 at 2:57

GoogleCodeExporter commented 9 years ago
seems to still be happening on the current 'stable' build
prettify-1-Jun-2011.tar.bz2
prettify-small-1-Jun-2011.tar.bz2

Original comment by jpill...@gmail.com on 17 Sep 2012 at 12:02