Re: [R] R-code in html help pages: syntax highlighting

2009-03-17 Thread Wacek Kusnierczyk
Romain Francois wrote: > Wacek Kusnierczyk wrote: >> >> >>> Duncan Murdoch wrote: >>> >>> So if you've got high standards, it's probably quite hard. On the other hand, if you're willing to accept the usual sort of errors that syntax highlighters make, it's not so bad, but not triv

Re: [R] R-code in html help pages: syntax highlighting

2009-03-17 Thread Romain Francois
Wacek Kusnierczyk wrote: Romain Francois wrote: Duncan Murdoch wrote: That is an issue. I guess I will fall back on what the parser says and infer on the scoping. Within the lines below, mean would be different each time mean( 1:10 ) lapply( 1:10, mean) mean <- (1+4) / 2 lapply( list( mean,

Re: [R] R-code in html help pages: syntax highlighting

2009-03-17 Thread Wacek Kusnierczyk
Romain Francois wrote: > Duncan Murdoch wrote: > > That is an issue. I guess I will fall back on what the parser says and > infer on the scoping. Within the lines below, mean would be different > each time > > mean( 1:10 ) > lapply( 1:10, mean) > mean <- (1+4) / 2 > lapply( list( mean, median), fun

Re: [R] R-code in html help pages: syntax highlighting

2009-03-16 Thread Romain Francois
Duncan Murdoch wrote: On 16/03/2009 5:06 PM, Romain Francois wrote: hadley wickham wrote: It would be pretty easy to use the output from the R parser (which is never wrong, is it?), and dump some markup out of it. For example the showTree function in codetools dumps an R expression as Lisp, th

Re: [R] R-code in html help pages: syntax highlighting

2009-03-16 Thread Duncan Murdoch
On 16/03/2009 5:06 PM, Romain Francois wrote: hadley wickham wrote: It would be pretty easy to use the output from the R parser (which is never wrong, is it?), and dump some markup out of it. For example the showTree function in codetools dumps an R expression as Lisp, this is not too far from g

Re: [R] R-code in html help pages: syntax highlighting

2009-03-16 Thread Romain Francois
hadley wickham wrote: It would be pretty easy to use the output from the R parser (which is never wrong, is it?), and dump some markup out of it. For example the showTree function in codetools dumps an R expression as Lisp, this is not too far from generating html, or any other markup. As this s

Re: [R] R-code in html help pages: syntax highlighting

2009-03-16 Thread hadley wickham
> It would be pretty easy to use the output from the R parser (which is never > wrong, is it?), and dump some markup out of it. For example the showTree > function in codetools dumps an R expression as Lisp, this is not too far > from generating html, or any other markup. > > As this sounds like fu

Re: [R] R-code in html help pages: syntax highlighting

2009-03-16 Thread Duncan Murdoch
On 3/16/2009 2:50 PM, Romain Francois wrote: Duncan Murdoch wrote: On 3/16/2009 1:49 PM, Jose Quesada wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, A follow up to my previous post. It'd be good to have syntax highlighting in the html help pages. This needs two things: making

Re: [R] R-code in html help pages: syntax highlighting

2009-03-16 Thread Romain Francois
Duncan Murdoch wrote: On 3/16/2009 1:49 PM, Jose Quesada wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, A follow up to my previous post. It'd be good to have syntax highlighting in the html help pages. This needs two things: making the highlight program available to R, and the

Re: [R] R-code in html help pages: syntax highlighting

2009-03-16 Thread Duncan Murdoch
On 3/16/2009 1:49 PM, Jose Quesada wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, A follow up to my previous post. It'd be good to have syntax highlighting in the html help pages. This needs two things: making the highlight program available to R, and then adding it to the Rd t

Re: [R] R-code in html help pages: syntax highlighting

2009-03-16 Thread Romain Francois
Hi Jose, highlight is fairly easy to use from command line. I have something like this when I use R from a console that supports color characters: highlight <- function( fun ){ fun <- match.fun( fun ) tf <- tempfile() dump( "fun", tf ) system( sprintf( "highlight -A -S R %s", tf ) ) unlin

[R] R-code in html help pages: syntax highlighting

2009-03-16 Thread Jose Quesada
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, A follow up to my previous post. It'd be good to have syntax highlighting in the html help pages. There is highlight (http://www.andre-simon.de/) which seems to be open source. Since code is delimited in the help file format, it should not be too