tylerlong / google-code-prettify

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

Blogger breaks regular expresions #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Turn Firebug Console on
2. Insert the javascript code into blogger
3. Load the blog

What is the expected output?  What do you see instead?
Should highlight the code, but instead dies with a syntax error.
Looking through the code you can see that some lines are missing

What version are you using?  On what browser?
Mozilla Firefox 3

Please provide any additional information below.
In order to fix this, look for regular expressions with "lower than"
symbols and replace the /regexp/ syntax for the new RegExp("regexp") syntax

Original issue reported on code.google.com by tereva...@gmail.com on 12 Nov 2008 at 12:21

GoogleCodeExporter commented 9 years ago
I'm not sure I understand.

Can the file as is not be used with blogger because blogger breaks regular 
expression
literals when loading third-party scripts?

Is there any documentation on this bug in blogger?  Have they posted this as a
workaround or are they planning on fixing the underlying problem?

Original comment by mikesamuel@gmail.com on 6 Jan 2009 at 10:45

GoogleCodeExporter commented 9 years ago
Ok, here's what I did.
I pasted the whole code as a blogger gadget in my blog so it would load on 
every page.
For some reason (hacking protection I presume), blogger messes the regular
expressions in the code.
Looking through the code I found that lines went missing after any "lower than"
symbols inside regular expressions. 
I finally fixed it by changing the regular expressions syntax as explained here:
http://www.w3schools.com/jsref/jsref_obj_regexp.asp

I have found no report on this issue anywhere in blogger

Original comment by tereva...@gmail.com on 16 Jan 2009 at 3:09

GoogleCodeExporter commented 9 years ago
Hmm.  I suppose I could try to do /\x3c/ instead of /</ without greatly 
increasing
file size.
Without some kind of linter, it'll be hard to maintain.
How is this being used?  Is it available as a blogger gadget somewhere?  Does 
it use
the minified version of the code, and which language extensions if any?

Original comment by mikesamuel@gmail.com on 19 May 2009 at 5:19

GoogleCodeExporter commented 9 years ago
I just copied and pasted the code into my blog.
No gadgets

Original comment by tereva...@gmail.com on 19 May 2009 at 9:32

GoogleCodeExporter commented 9 years ago
If this is a real issue for you, I'd alert the blogger folks to it, but making 
sure
that things work after copying and pasting into blogger would significantly 
slow down
my testing and I already have trouble finding time to fix bugs for this project.

Sorry.

Original comment by mikesamuel@gmail.com on 14 Aug 2009 at 6:04