How to do xml syntax hilighting in Respec

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to do xml syntax hilighting in Respec

Pratik Datta

Can ReSpec  do syntax highlighting?

 

I am trying to get it to syntax highlight an XML snippet, and it is not doing that.

 

I tried

<pre class= “example”>

  &lt;book/&gt;

</pre>

 

 

I also tried with class= “example sh_xml”  but that didn’t work either.

 

Pratik

Reply | Threaded
Open this post in threaded view
|

Re: How to do xml syntax hilighting in Respec

Robin Berjon-2
Hi,

On Jun 29, 2010, at 08:39 , Pratik Datta wrote:
> Can ReSpec  do syntax highlighting?

Yes.

> I am trying to get it to syntax highlight an XML snippet, and it is not doing that.
>  
> I tried
> <pre class= “example”>
>   &lt;book/&gt;
> </pre>
>  
> I also tried with class= “example sh_xml”  but that didn’t work either.

The latter should work. If you look at http://dev.w3.org/2006/waf/widgets-access/ you can see that the examples are highlighted.

In your email you're using “” as quote characters instead of "" or '', is that in the source or only something that your email client did?

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




Reply | Threaded
Open this post in threaded view
|

RE: How to do xml syntax hilighting in Respec

Pratik Datta
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.

Pratik



-----Original Message-----
From: Robin Berjon [mailto:[hidden email]]
Sent: Tuesday, June 29, 2010 1:32 AM
To: Pratik Datta
Cc: Spec Prod
Subject: Re: How to do xml syntax hilighting in Respec

Hi,

On Jun 29, 2010, at 08:39 , Pratik Datta wrote:
> Can ReSpec  do syntax highlighting?

Yes.

> I am trying to get it to syntax highlight an XML snippet, and it is not doing that.
>  
> I tried
> <pre class= "example">
>   &lt;book/&gt;
> </pre>
>  
> I also tried with class= "example sh_xml"  but that didn't work either.

The latter should work. If you look at http://dev.w3.org/2006/waf/widgets-access/ you can see that the examples are highlighted.

In your email you're using "" as quote characters instead of "" or '', is that in the source or only something that your email client did?

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




Reply | Threaded
Open this post in threaded view
|

Re: How to do xml syntax hilighting in Respec

Robin Berjon-2
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/




Reply | Threaded
Open this post in threaded view
|

RE: How to do xml syntax hilighting in Respec

Pratik Datta
That worked!
Thanks

Pratik

-----Original Message-----
From: Robin Berjon [mailto:[hidden email]]
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/