W3C home > Mailing lists > Public > spec-prod@w3.org > July to September 2010

RE: How to do xml syntax hilighting in Respec

From: Pratik Datta <pratik.datta@oracle.com>
Date: Fri, 2 Jul 2010 06:12:18 -0700 (PDT)
Message-ID: <dc3b2187-6905-4c87-8fc0-231ae130c789@default>
To: Robin Berjon <robin@berjon.com>
Cc: Spec Prod <spec-prod@w3.org>, Frederick Hirsch <frederick.hirsch@nokia.com>, Thomas Roessler <tlr@w3.org>
That worked!


-----Original Message-----
From: Robin Berjon [mailto:robin@berjon.com] 
Sent: Wednesday, June 30, 2010 1:14 AM
To: Pratik Datta
Cc: Spec Prod; Frederick Hirsch; Thomas Roessler
Subject: 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 Friday, 2 July 2010 13:14:53 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:42:18 UTC