Custom XML Pretty Printer
Hi there, See http://gitorious.org/xml-pretty-printer-module-for-context for testing. As soon as I have made more testing and some improvements (inc. cleaning up), I'll submit to tlcontrib. Cheers, Renaud
Now available on tlcontrib: http://tlcontrib.metatex.org/cgi-bin/package.cgi/ruid=4591828845/action=view... Cheers, Renaud Le 18/12/2010 23:39, Renaud AUBIN a écrit :
Hi there,
See http://gitorious.org/xml-pretty-printer-module-for-context for testing. As soon as I have made more testing and some improvements (inc. cleaning up), I'll submit to tlcontrib.
Cheers,
Renaud ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On Sun, 16 Jan 2011, Renaud AUBIN wrote:
Now available on tlcontrib: http://tlcontrib.metatex.org/cgi-bin/package.cgi/ruid=4591828845/action=view...
Any particular reasons why the spaces are not part of the syntax highlighting group? For example just add \def\RaXmlSnippetComment#1{«#1»} and observe the output: «<!--» «T»«h»«a»«t» «i»«s» «a» «t»«e»«s»«t» «-->» I want to use a different syntax highlighting scheme that provides background colors and such. For that, it will be much nicer if the output were «<!-- That is a test -->» Is that possible? Aditya
Hi Aditya and happy ConTeXters, I've worked at the beginning to include those spaces in the different syntax highlighting groups but failed. Considering the definition of Comment in the grammar provided by t-pretty-ra-xml.lua: −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− we have the following lua code: Comment = makepattern(handler,"comment", Comment_open) * ( V("line") + V("whitespace") + makepattern(handler, "comment", Comment_content) )^0 * makepattern(handler,"comment", Comment_close), Here I use the fallback mechanism to the default grammar, defined in v-default.lua, with V("line") and V("whitespace"). −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− To circumvent the problem described by Aditya, I assumed that I could do (since I cannot remember my first experiments, ante git versioning): local line = patterns.newline * (patterns.emptyline)^0 * patterns.beginline local whitespace = (patterns.space + line)^1 […] Comment = makepattern(handler,"comment", Comment_open) * ( makepattern(handler, "comment", line + whitespace + Comment_content) )^0 * makepattern(handler,"comment", Comment_close), The newlines are no more detected… I've tried some other code but everything failed… I don't know if this is related but, as you have probably noticed, I don't manage multiple empty lines too. I'm out of ideas, good as bad… Hans, or another Guru, to the rescue? More than a solution for Aditya, it would be nice to give me some line/space stuffs' tricks since the resulting code could be cleaner and leaner too… Cheers, Renaud Le 16/01/2011 23:06, Aditya Mahajan a écrit :
On Sun, 16 Jan 2011, Renaud AUBIN wrote:
Now available on tlcontrib: http://tlcontrib.metatex.org/cgi-bin/package.cgi/ruid=4591828845/action=view...
Any particular reasons why the spaces are not part of the syntax highlighting group? For example just add
\def\RaXmlSnippetComment#1{«#1»}
and observe the output:
«<!--» «T»«h»«a»«t» «i»«s» «a» «t»«e»«s»«t» «-->»
I want to use a different syntax highlighting scheme that provides background colors and such. For that, it will be much nicer if the output were
«<!-- That is a test -->»
Is that possible?
Aditya
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Hi Aditya, I'm working on that… When do you need it? Cheers, Renaud Le 16/01/2011 23:06, Aditya Mahajan a écrit :
On Sun, 16 Jan 2011, Renaud AUBIN wrote:
Now available on tlcontrib: http://tlcontrib.metatex.org/cgi-bin/package.cgi/ruid=4591828845/action=view...
Any particular reasons why the spaces are not part of the syntax highlighting group? For example just add
\def\RaXmlSnippetComment#1{«#1»}
and observe the output:
«<!--» «T»«h»«a»«t» «i»«s» «a» «t»«e»«s»«t» «-->»
I want to use a different syntax highlighting scheme that provides background colors and such. For that, it will be much nicer if the output were
«<!-- That is a test -->»
Is that possible?
Aditya
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On Tue, 18 Jan 2011, Renaud AUBIN wrote:
Hi Aditya,
I'm working on that…
Thank you.
When do you need it?
Well... it is not urgent for me ... t-vim is slow but it works fine :) I was planning on a more advanced syntax highlighting module that will allow one to use different external highlighters: editors like vim, scite, etc., programs like syntax-color, pgyments, HsColor, etc, or even web services like hpaste.org or gist. At this time, all this at a dreaming stage, and I think that it will nice to be able to change the parser without changing the color scheme (and hence the request for group each code region in one command which will allow for a module to specify the unified color schemes) Aditya
participants (2)
-
Aditya Mahajan
-
Renaud AUBIN