Hi textmates,
A while ago I was asking about mixing R and markdown in a similar way Sweave uses LaTeX to document R codes. It turns out the "brew" package (https://stat.ethz.ch/pipermail/r-packages/2007/000327.html) can make this very easy: any text outside markers in the document is unprocessed by R and returned unchanged, while R code chunks inside some special tags is run by R (creating graphics, etc...). This combined with Multimarkdown provides a very powerful workflow (by-passing the latex syntax and long compilation time I find overly intruding in Sweave).
Obviously, I'd love to have a custom syntax highlighting to go with this new approach. It would be heavily based on Sweave's bundle, with only a few differences:
1) Multimarkdown is to be used as the normal text syntax (conditional syntax highlighting and commands)
2) the "@" and "<< >>" delimiters are now replaced by "<%"
( 3) instead of calling latex, the perl script for multimardown could be used )
I've tried to tweak the Sweave bundle, but I don't really understand the code to be honest: i think i was too naive in thinking that changing sweave to "breweave" and text.tex.latex to text.html.markdown.multimarkdown everywhere could work.
Is there some sort of guidelines I should follow to modify the Sweave bundle? Would this be fairly doable by a novice in Ruby and TM macros?
Best regards,
baptiste
__________________________________________________ Do You Yahoo!? En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités http://mail.yahoo.fr Yahoo! Mail
Hi Baptiste,
you are probably not too far, I assume you have read chapter 12 from the manual carefully? If not, I think that would be the key missing piece: http://macromates.com/textmate/manual/ language_grammars#language_grammars
This should tell you about meanings of all those weird words here and there, like "match", "pattern", . The only other piece missing is regular expressions. In particular, you would have to change the places were << and @ were matched to the new correct things. Looking at how Erb does that might help (hm, I've been out of touch with TM development for a while, where are the rules for matching <% ... %> in erb files?).
I wrote the syntax a while back, but I don't think anyone has modified it since. I'm a bit rusty on it atm, but feel free to pick my brain if/when you get stuck.
Haris Skiadas Department of Mathematics and Computer Science Hanover College
On May 25, 2008, at 9:44 AM, baptiste auguie wrote:
Hi textmates,
A while ago I was asking about mixing R and markdown in a similar way Sweave uses LaTeX to document R codes. It turns out the "brew" package (https://stat.ethz.ch/pipermail/r-packages/ 2007/000327.html) can make this very easy: any text outside markers in the document is unprocessed by R and returned unchanged, while R code chunks inside some special tags is run by R (creating graphics, etc...). This combined with Multimarkdown provides a very powerful workflow (by-passing the latex syntax and long compilation time I find overly intruding in Sweave).
Obviously, I'd love to have a custom syntax highlighting to go with this new approach. It would be heavily based on Sweave's bundle, with only a few differences:
- Multimarkdown is to be used as the normal text syntax
(conditional syntax highlighting and commands)
- the "@" and "<< >>" delimiters are now replaced by "<%"
( 3) instead of calling latex, the perl script for multimardown could be used )
I've tried to tweak the Sweave bundle, but I don't really understand the code to be honest: i think i was too naive in thinking that changing sweave to "breweave" and text.tex.latex to text.html.markdown.multimarkdown everywhere could work.
Is there some sort of guidelines I should follow to modify the Sweave bundle? Would this be fairly doable by a novice in Ruby and TM macros?
Best regards,
baptiste