Anybody have an XML pretty printer ConTeXt document? That would make a great example of generic XML processing. Thanks, -pd
I'm currently working on a pret-xml.lua if you are interested… I have started it last year, forgot it, then began to rewrite it from scratch last week… I would like to obtain a rendering similar to oXygen xml. That is a work in progress, but you can check it out: http://www.nibua-r.org/gitsnap/pret-xml/ Le 12/11/2010 21:22, Peter Davis a écrit :
Anybody have an XML pretty printer ConTeXt document? That would make a great example of generic XML processing.
Thanks, -pd
___________________________________________________________________________________ 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 ___________________________________________________________________________________
Some precision. I don't think you could consider any pret-xml.lua as an example of XML processing. What processing would you apply to your XML file? Are considering to use directly lua to process your XML inputs? Sorry, but that's not clear to me… You are certainly aware of the fact that there is a plenty of SAX / XmlPulParser / CodeSynthesis Tree or parser samples around on the www. Renaud Le 12/11/2010 21:22, Peter Davis a écrit :
Anybody have an XML pretty printer ConTeXt document? That would make a great example of generic XML processing.
Thanks, -pd
___________________________________________________________________________________ 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 ___________________________________________________________________________________
I was thinking of doing all the XML parsing in TeX/ConTeXt, so I was looking
for examples of that. I'm still trying to learn my way around ConTeXt, and
XML handling in particular, so I thought a pretty printer would be a good
example.
Thank you!
-pd
On Sat, Nov 13, 2010 at 6:23 AM, Renaud AUBIN
Some precision. I don't think you could consider any pret-xml.lua as an example of XML processing. What processing would you apply to your XML file? Are considering to use directly lua to process your XML inputs? Sorry, but that's not clear to me… You are certainly aware of the fact that there is a plenty of SAX / XmlPulParser / CodeSynthesis Tree or parser samples around on the www.
Renaud
Le 12/11/2010 21:22, Peter Davis a écrit :
Anybody have an XML pretty printer ConTeXt document? That would make a great example of generic XML processing.
Thanks, -pd
Hi, Another Correspondence question. In the default, I'd like the body text to be left justified rather than both left and right justified. Does the \setupletterstyle [content][align=left] do this? (or some form thereof)? I can't get this to work. Also, how can I have the 'Date' word not show up, just the actual date itself. Thanks again. Russ
On Nov 13, 2010, at 14:28 , Russell Urquhart wrote:
Hi,
Another Correspondence question. In the default, I'd like the body text to be left justified rather than both left and right justified.
Does the
\setupletterstyle [content][align=left]
Hi, \setupletterstyle [content] [align=flushleft] should do the trick.
do this? (or some form thereof)? I can't get this to work.
Also, how can I have the 'Date' word not show up, just the actual date itself.
Do you mean the label in the reference line? Then try \setuplabeltext[letter:date={}] Florian
That did the trick! Thank you very much! Russ On Sat, Nov 13, 2010 at 06:10:42PM +0100, Florian Wobbe wrote:
On Nov 13, 2010, at 14:28 , Russell Urquhart wrote:
Hi,
Another Correspondence question. In the default, I'd like the body text to be left justified rather than both left and right justified.
Does the
\setupletterstyle [content][align=left]
Hi,
\setupletterstyle [content] [align=flushleft]
should do the trick.
do this? (or some form thereof)? I can't get this to work.
Also, how can I have the 'Date' word not show up, just the actual date itself.
Do you mean the label in the reference line? Then try
\setuplabeltext[letter:date={}]
Florian
___________________________________________________________________________________ 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 ___________________________________________________________________________________
I'm currently working on my pret-xml… just implementing attributes parsing… I will upload that asap (even if my lua is… really bad ;) ) My two cents: depending of the complexity of the underlying data model tranported by your xml medium, you should consider another tool (xsltproc, saxon, xsdcxx, …) and integrate it in your production chain. Could you describe in detail what your need is (in or off-list)? Renaud Le 13/11/2010 13:52, Peter Davis a écrit :
I was thinking of doing all the XML parsing in TeX/ConTeXt, so I was looking for examples of that. I'm still trying to learn my way around ConTeXt, and XML handling in particular, so I thought a pretty printer would be a good example.
Thank you! -pd
On Sat, Nov 13, 2010 at 6:23 AM, Renaud AUBIN
wrote: Some precision. I don't think you could consider any pret-xml.lua as an example of XML processing. What processing would you apply to your XML file? Are considering to use directly lua to process your XML inputs? Sorry, but that's not clear to me… You are certainly aware of the fact that there is a plenty of SAX / XmlPulParser / CodeSynthesis Tree or parser samples around on the www.
Renaud
Le 12/11/2010 21:22, Peter Davis a écrit :
Anybody have an XML pretty printer ConTeXt document? That would make a great example of generic XML processing.
Thanks, -pd
___________________________________________________________________________________ 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 folks, My custom XML pretty printer: http://www.nibua-r.org/gitsnap/pret-xml/ A direct link to the sample: http://www.nibua-r.org/gitsnap/pret-xml/pret-xml_test.pdf I'm sorry, the lua code is quite bad but I will improve it as soon as I will figure out how to implement functors… Feel free to improve… Renaud Le 13/11/2010 14:29, Renaud AUBIN a écrit :
I'm currently working on my pret-xml… just implementing attributes parsing… I will upload that asap (even if my lua is… really bad ;) )
My two cents: depending of the complexity of the underlying data model tranported by your xml medium, you should consider another tool (xsltproc, saxon, xsdcxx, …) and integrate it in your production chain.
Could you describe in detail what your need is (in or off-list)?
Renaud
Le 13/11/2010 13:52, Peter Davis a écrit :
I was thinking of doing all the XML parsing in TeX/ConTeXt, so I was looking for examples of that. I'm still trying to learn my way around ConTeXt, and XML handling in particular, so I thought a pretty printer would be a good example.
Thank you! -pd
On Sat, Nov 13, 2010 at 6:23 AM, Renaud AUBIN
wrote: Some precision. I don't think you could consider any pret-xml.lua as an example of XML processing. What processing would you apply to your XML file? Are considering to use directly lua to process your XML inputs? Sorry, but that's not clear to me… You are certainly aware of the fact that there is a plenty of SAX / XmlPulParser / CodeSynthesis Tree or parser samples around on the www.
Renaud
Le 12/11/2010 21:22, Peter Davis a écrit :
Anybody have an XML pretty printer ConTeXt document? That would make a great example of generic XML processing.
Thanks, -pd
___________________________________________________________________________________ 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 ___________________________________________________________________________________
___________________________________________________________________________________ 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 Sat, 13 Nov 2010 19:39:31 +0100
Renaud AUBIN
Hi folks,
My custom XML pretty printer: http://www.nibua-r.org/gitsnap/pret-xml/ A direct link to the sample: http://www.nibua-r.org/gitsnap/pret-xml/pret-xml_test.pdf
I'm sorry, the lua code is quite bad but I will improve it as soon as I will figure out how to implement functors
Feel free to improve
Renaud
Pardon my ignorance, but where in your test file is your pretty printer invoked? Aren't the colors you get the default ConTeXt colors? Thomas
The local pret-xml.lua is used when running context on pret-xml_test from the basedir. To get the original pret-xml.lua and check the differences, just rename pret-xml.lua to pret-xml.new and re-run context… You should see some differences between the good ol'pret-xml and the draft of mine… I don't remember if that's due to my configuration or if that's the default behavior… The color used is indeed the default one… See my last post "[NTG-context] Dummy buff-ver.mkiv question". Renaud Le 13/11/2010 21:18, Thomas Schmitz a écrit :
On Sat, 13 Nov 2010 19:39:31 +0100 Renaud AUBIN
wrote: Hi folks,
My custom XML pretty printer: http://www.nibua-r.org/gitsnap/pret-xml/ A direct link to the sample: http://www.nibua-r.org/gitsnap/pret-xml/pret-xml_test.pdf
I'm sorry, the lua code is quite bad but I will improve it as soon as I will figure out how to implement functors…
Feel free to improve…
Renaud
Pardon my ignorance, but where in your test file is your pretty printer invoked? Aren't the colors you get the default ConTeXt colors?
Thomas
___________________________________________________________________________________
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 Sat, 13 Nov 2010 21:32:09 +0100
Renaud AUBIN
The local pret-xml.lua is used when running context on pret-xml_test from the basedir. To get the original pret-xml.lua and check the differences, just rename pret-xml.lua to pret-xml.new and re-run context You should see some differences between the good ol'pret-xml and the draft of mine I don't remember if that's due to my configuration or if that's the default behavior
The color used is indeed the default one See my last post "[NTG-context] Dummy buff-ver.mkiv question".
Renaud
Ah OK, now I see. But I don't think this is a good idea - creating your own file with the same name as files in the core. You should at least add a "t-" to the name so people see it's a "third party" addition. Thomas
This is a draft for review, not yet even the beginning of a real third party module… As soon as I will integrate the reviews from interested people, I will properly set the third module stuff… Thank you for your advice. Renaud Le 13/11/2010 21:40, Thomas Schmitz a écrit :
On Sat, 13 Nov 2010 21:32:09 +0100 Renaud AUBIN
wrote: The local pret-xml.lua is used when running context on pret-xml_test from the basedir. To get the original pret-xml.lua and check the differences, just rename pret-xml.lua to pret-xml.new and re-run context… You should see some differences between the good ol'pret-xml and the draft of mine… I don't remember if that's due to my configuration or if that's the default behavior…
The color used is indeed the default one… See my last post "[NTG-context] Dummy buff-ver.mkiv question".
Renaud
Ah OK, now I see. But I don't think this is a good idea - creating your own file with the same name as files in the core. You should at least add a "t-" to the name so people see it's a "third party" addition.
Thomas ___________________________________________________________________________________
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 folks, For imormation, I'm curently rewritting the pret-xml.lua file pointed on that list previously… So don't miss too much time to review! I'm using LPEG now and I hope to submit something operational last week for those interested… The result will be far better than the previous version… Renaud
Hi ConTeXters,
I have a first "operational" version of my lpeg-based xml pretty
printer: http://www.nibua-r.org/gitsnap/pret-xml/
"operational" means:
1 − That pretty printer will type only partially valid xml file
<test></other> will be considered valid
Hi folks,
For imormation, I'm curently rewritting the pret-xml.lua file pointed on that list previously… So don't miss too much time to review!
I'm using LPEG now and I hope to submit something operational last week for those interested… The result will be far better than the previous version…
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 ___________________________________________________________________________________
Ooops, it's not a detail but I need to precise that if the xml input is not valid (from my custom pret-xml pov), nothing will be processed! Renaud Le 20/11/2010 20:40, Renaud AUBIN a écrit :
Hi ConTeXters,
I have a first "operational" version of my lpeg-based xml pretty printer: http://www.nibua-r.org/gitsnap/pret-xml/ "operational" means:
1 − That pretty printer will type only partially valid xml file <test></other> will be considered valid
is not considered valid … 2 − A real namespace management is missing, thus foons declarations will be prettyfied as standard attribute and foo: will be processed just as plain tag name.
3 − Endlines within CharData are not yet supported.
As I'm a lua and lpeg beginner, the code provided is not subtle nor optimized…
That pretty printer is slightly different of standard pretty printer since a lpeg grammar is applied on a full buffer, i.e. not on a line-pre-line based approach. The main drawback, not verified, is that if you have a huge xml file to process, it will just explode the stack… An analogy: in memory tree xml vs. parser…
It's far from perfect but you are welcome to use, review and give feedbacks…
(… and OK, it's not packaged as a third party module yet…)
Renaud
+ zip and tar.gz available http://www.nibua-r.org/gitsnap/
I have a first "operational" version of my lpeg-based xml pretty printer: http://www.nibua-r.org/gitsnap/pret-xml/
On 20-11-2010 8:40, Renaud AUBIN wrote:
I have a first "operational" version of my lpeg-based xml pretty printer: http://www.nibua-r.org/gitsnap/pret-xml/ "operational" means:
A remark: I'm currently replacing the current pretty printing interface and the new infrastructure is based on lpeg (which was not around when I did the first implementation). This is part of the work on cld (where verbatim has its own niche). As I think that there are different demands for pretty printing it will be easier for users to plug in code. Also, there will be less tex code involved as the cld interface is used at the lua end, i.e. there are regular lua functions for dealing with it. As you already are playing with pretty printing I'm sure that you will be able to plug in your code. But, naming is important and may not override the built in methods. By default there will be the following pretty printers: - v-tex - v-metapost - v-lua - v-xml These are dumb variants, insensitive for syntax errors which is handy for manuals. In addition there will be: - v-lua-plus (name can change) - v-xml-plus (name can change) where the first one replaces the cdx code now used for documenting (so this targets at luigi) and can mix lua code with documentation. The second one is used by myself when documenting xml code and uses the built in parser. Now, additional pretty printers can be plugged in as well (there is a register function for that) and can have names not starting with v-. Even better, they can be regular user modules, so in your case u-pretty-ra-xml.tex or so will do. There are already some basic pretty lpeg helpers that will take care of (visualizing) spacing, lines, and more. In principle one can also mix pretty printers (so, lua code inside tex code and alike). It also means that other pret-* code has to be adapted (and ends up in the u-pretty-* namespace). Sorry for the inconvenience. More later. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (6)
-
Florian Wobbe
-
Hans Hagen
-
Peter Davis
-
Renaud AUBIN
-
Russell Urquhart
-
Thomas Schmitz