Re: How to do xml syntax hilighting in Respec

On Jun 29, 2010, at 20:18 , Pratik Datta wrote:
> Those special double quotes are not in my html,  Outlook tried to be smart, and fix my regular quotes.
> 
> Here is my html file
> http://www.w3.org/2008/xmlsec/Drafts/proposals/Streamable-XPath-subset-src.html
> 
> I looked the error console and I see this error:
> 
> Error: o is undefined
> Source File: http://dev.w3.org/2009/dap/ReSpec.js/js/sh_main.min.js
> Line: 4
> 
> However this one that you sent http://dev.w3.org/2006/waf/widgets-access/  works fine on my browser with syntax highlighting and all. I don't understand why my html is giving the error.

I've partly tracked it down and it is not your fault. The syntax highlighting code that I use has its own dependency loading code, and apparently it works perfectly fine when loading from a relative URL, but seems to be getting confused by absolute URLs (whether a relative or an absolute URL is used depends on how you refer to ReSpec, in your spec you're using an absolute src).

I find this quite puzzling, and given that I've decided to use a different syntax highlighting library for v2 I haven't dug deep into why the current one is failing.

I have, however, found a workaround. Since it's failing to load its grammar file, all you need to do is to load it yourself directly before calling ReSpec. So just adding the following should work:

  <script src='http://dev.w3.org/2009/dap/ReSpec.js/js/lang/sh_xml.min.js' class='remove'></script>

-- 
Robin Berjon - http://berjon.com/

Received on Wednesday, 30 June 2010 08:15:12 UTC