From: Wolfgang K. <fel...@gm...> - 2009-08-19 11:49:20
|
Hello, this may be heresy to ask but... ...is there a way to use python's docutils with other languages, specifically SQL? I'd like to put the entire documentation for a database model as ReST comments into the SQL source, just like with Python. TIA, Sincerely, Wolfgang -- NO "Courtesy Copies" PLEASE! |
From: Michael F. <fuz...@vo...> - 2009-08-19 13:12:44
|
Wolfgang Keller wrote: > Hello, > > this may be heresy to ask but... > > ...is there a way to use python's docutils with other languages, specifically SQL? > > So you're asking for an implementation of docutils in SQL? I've never heard of such a thing. Postgres will let you write stored procedures in Python though I believe. Michael > I'd like to put the entire documentation for a database model as ReST comments into the SQL source, just like with Python. > > TIA, > > Sincerely, > > Wolfgang > > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog |
From: Ben F. <ben...@be...> - 2009-08-19 22:35:19
|
Wolfgang Keller <fel...@gm...> writes: > ...is there a way to use python's docutils with other languages, > specifically SQL? The markup specification is not Python-specific. You certainly could store reST documents as SQL TEXT fields. > I'd like to put the entire documentation for a database model as ReST > comments into the SQL source, just like with Python. You'll need to come up with a tool to extract them and process them, then. Nothing about the specification makes that particularly difficult, to my knowledge; but contrariwise, I'm not aware of anyone who has already done it. There's no reason, of course, you couldn't write a Python tool to extract the reST from the SQL comments and process it with the Docutils library. That may be the simplest way to proceed. -- \ “I was once walking through the forest alone and a tree fell | `\ right in front of me, and I didn't hear it.” —Steven Wright | _o__) | Ben Finney |
From: Wolfgang K. <fel...@gm...> - 2009-08-20 10:29:59
|
> There's no reason, of course, you couldn't write a Python tool to > extract the reST from the SQL comments and process it with the Docutils > library. That may be the simplest way to proceed. And that was exactly what I was looking for. But I had hoped that someone else has already done it. ;-) Sincerely, Wolfgang -- NO "Courtesy Copies" PLEASE! |
From: Guenter M. <mi...@us...> - 2009-08-20 08:05:29
|
On 2009-08-19, Wolfgang Keller wrote: > ...is there a way to use python's docutils with other languages, > specifically SQL? There are many many ways... > I'd like to put the entire documentation for a database model as ReST > comments into the SQL source, just like with Python. One way would be to use PyLit__: PyLit (Python-Literate) provides a plain but efficient tool for literate programming: a bidirectional converter between * a "text" source with embedded code blocks and * a "code" source with the documentation in comment blocks. You can also extract just the text- or code-blocks. It is written in Python but should work with any programming language that provides a syntax for comment blocks. Günter __ http://pylit.berlios.de |
From: Ben F. <ben...@be...> - 2009-08-20 09:12:09
|
Guenter Milde <mi...@us...> writes: > One way would be to use PyLit__: […] > It is written in Python but should work with any programming language > that provides a syntax for comment blocks. SQL doesn't have block comments, if by that you mean multi-line comments. It has only end-of-line comments. Does the approach work with that? -- \ “First they came for the verbs, and I said nothing, for verbing | `\ weirds language. Then, they arrival for the nouns and I speech | _o__) nothing, for I no verbs.” —Peter Ellis | Ben Finney |
From: Marc 'B. R. <ma...@ri...> - 2009-08-20 09:49:07
|
On Thursday 20 August 2009, Ben Finney wrote: > Guenter Milde <mi...@us...> writes: > > One way would be to use PyLit__: > > […] > > > It is written in Python but should work with any programming > > language that provides a syntax for comment blocks. > > SQL doesn't have block comments, if by that you mean multi-line > comments. It has only end-of-line comments. Does the approach work > with that? Yes. I don't even know if PyLit can handle multiline comments. Ciao, Marc 'BlackJack' Rintsch -- “Dealing with failure is easy: Work hard to improve. Success is also easy to handle: You've solved the wrong problem. Work hard to improve.” -- Alan J. Perlis |
From: Guenter M. <mi...@us...> - 2009-08-20 10:54:41
|
On 2009-08-20, Marc 'BlackJack Rintsch wrote: > On Thursday 20 August 2009, Ben Finney wrote: >> Guenter Milde <mi...@us...> writes: >> > One way would be to use PyLit__: >> > It is written in Python but should work with any programming >> > language that provides a syntax for comment blocks. >> SQL doesn't have block comments, if by that you mean multi-line >> comments. It has only end-of-line comments. Does the approach work >> with that? > Yes. With comment blocks, I mean document parts that are * separated from code by a blank line * commented (preferabely with and begin-comment char at the start of the line). > I don't even know if PyLit can handle multiline comments. There is a basic filter to convert C to C++ comments. Works line-wise and only converts lines that * start with "/* " and end with " */" (followed by whitespace only) Improved support is possible but currently not a much requested feature. Günter |