W3C home > Mailing lists > Public > spec-prod@w3.org > April to June 2010

Re: How to do xml syntax hilighting in Respec

From: Robin Berjon <robin@berjon.com>
Date: Wed, 30 Jun 2010 10:14:11 +0200
Cc: Spec Prod <spec-prod@w3.org>, Frederick Hirsch <frederick.hirsch@nokia.com>, Thomas Roessler <tlr@w3.org>
Message-Id: <B8589D1D-2F85-4E06-A2EF-8EF063890222@berjon.com>
To: Pratik Datta <pratik.datta@oracle.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:19:17 GMT