digitalmars.D - embedding D in html: practical?
- Ben Hinkle (5/5) Aug 14 2005 I'm curious if anyone has been using the D feature of embedding D code i...
- Jarrett Billingsley (5/12) Aug 14 2005 I think it'd open up some interesting possibilities for IDEs. It'd be l...
- jmjmak utu.invalid.fi (7/19) Aug 14 2005 On other hand, all this can be done automatically with tools like doxyge...
- Ben Hinkle (9/38) Aug 14 2005 That's an interesting idea - runnable tutorial pages. We should try sett...
- Vathix (2/8) Aug 14 2005 That is also my view of this. With most of the D code I post on web page...
- Ben Hinkle (19/49) Aug 14 2005 I've been converting the examples in
- Dejan Lekic (10/10) Aug 14 2005 Mr. Hinkle,
- Ben Hinkle (10/19) Aug 14 2005 You misunderstand my intention. I agree writing the primary code in html...
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (33/50) Aug 14 2005 -----BEGIN PGP SIGNED MESSAGE-----
- Daniel Keep (18/77) Aug 26 2005
- janderson (8/23) Feb 02 2007 I would like this as well. I did some research to try and find a free
- janderson (3/29) Feb 02 2007 By HTML control I mean one that allows you to edit like a word doc. It
- Stewart Gordon (12/15) Feb 03 2007
- janderson (16/35) Feb 03 2007 I'd imagine if you had a control that you could make into your own
- Thomas Kuehne (20/33) Feb 03 2007 -----BEGIN PGP SIGNED MESSAGE-----
- pragma (21/26) Aug 14 2005 I'm in the same boat, I've given it a few tries. It does seem like a co...
I'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.
Aug 14 2005
"Ben Hinkle" <Ben_member pathlink.com> wrote in message news:ddnq6a$255k$1 digitaldaemon.com...I'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.I think it'd open up some interesting possibilities for IDEs. It'd be like combining the code with the docs - you could insert formatting, images, etc. interspersed with the code for docs.
Aug 14 2005
In article <ddo22b$2b1d$1 digitaldaemon.com>, Jarrett Billingsley says..."Ben Hinkle" <Ben_member pathlink.com> wrote in message news:ddnq6a$255k$1 digitaldaemon.com...On other hand, all this can be done automatically with tools like doxygen. I think there are some good things about html support. For example, it's very easy to test tutorial code found online by just compiling the web file. Still I don't think major projects should use this feature. It becomes quite cumbersome with bigger files. Jari-MattiI'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.I think it'd open up some interesting possibilities for IDEs. It'd be like combining the code with the docs - you could insert formatting, images, etc. interspersed with the code for docs.
Aug 14 2005
<jmjmak utu.invalid.fi> wrote in message news:ddo2ir$2bbh$1 digitaldaemon.com...In article <ddo22b$2b1d$1 digitaldaemon.com>, Jarrett Billingsley says...That's an interesting idea - runnable tutorial pages. We should try setting some up. In particular it would be nice if the D spec itself was runnable (I don't count the html page that explains how you can embed D in html as enough). D could be one of the first languages to be able to run its own spec :-) I'll give a shot at making the MinTL web page runnable - though still people will have to download and install the library specially."Ben Hinkle" <Ben_member pathlink.com> wrote in message news:ddnq6a$255k$1 digitaldaemon.com...On other hand, all this can be done automatically with tools like doxygen. I think there are some good things about html support. For example, it's very easy to test tutorial code found online by just compiling the web file. Still I don't think major projects should use this feature. It becomes quite cumbersome with bigger files. Jari-MattiI'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.I think it'd open up some interesting possibilities for IDEs. It'd be like combining the code with the docs - you could insert formatting, images, etc. interspersed with the code for docs.
Aug 14 2005
it's very easy to test tutorial code found online by just compiling the web file. Still I don't think major projects should use this feature. It becomes quite cumbersome with bigger files.That is also my view of this. With most of the D code I post on web pages I use this feature.
Aug 14 2005
I've been converting the examples in http://home.comcast.net/~benhinkle/mintl/index.html to use this embedded html stuff and it works fine but I have one small issue. When I put the hidden code in HTML comments dmd can't find it. Is there an easy way to prevent some non-comment HTML from rendering in browsers? The reason I want to hide some code is that each example in the document is a code fragment and I have these ugly code blocks that wrap the fragments into a main(): <code> int main() { </code> ... rest of document ... <code> return 0; } </code> Writing text in the help to explain what those wacky code blocks are doing is ugly so I'd like to hide them from the user. <jmjmak utu.invalid.fi> wrote in message news:ddo2ir$2bbh$1 digitaldaemon.com...In article <ddo22b$2b1d$1 digitaldaemon.com>, Jarrett Billingsley says..."Ben Hinkle" <Ben_member pathlink.com> wrote in message news:ddnq6a$255k$1 digitaldaemon.com...On other hand, all this can be done automatically with tools like doxygen. I think there are some good things about html support. For example, it's very easy to test tutorial code found online by just compiling the web file. Still I don't think major projects should use this feature. It becomes quite cumbersome with bigger files. Jari-MattiI'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.I think it'd open up some interesting possibilities for IDEs. It'd be like combining the code with the docs - you could insert formatting, images, etc. interspersed with the code for docs.
Aug 14 2005
Mr. Hinkle, I am one of those guys who like clean code. Don't You think having code inside bunch of HTML tags will just make a mess? I would personally avoid it. I do not even put huge comments before methods just because of this reason - I usually comment code separately inside per-class xhtml file. -- ........... Dejan Lekic http://dejan.lekic.org
Aug 14 2005
"Dejan Lekic" <leka entropy.tmok.com> wrote in message news:ddoori$2qaq$1 digitaldaemon.com...Mr. Hinkle, I am one of those guys who like clean code. Don't You think having code inside bunch of HTML tags will just make a mess? I would personally avoid it. I do not even put huge comments before methods just because of this reason - I usually comment code separately inside per-class xhtml file. -- ........... Dejan Lekic http://dejan.lekic.orgYou misunderstand my intention. I agree writing the primary code in html is silly. The file I'm talking about is the documentation for the package that has 4 or 5 line fragments of examples. These examples are the things that would be nice to put inside <code> blocks so that the doc file itself can be fed to dmd and run. The ratio of text to code is probably about 10 lines of text for every line of code. I don't understand the comment about xhtml - What comments and methods and classes are you referring to? Can you point me at an example web page?
Aug 14 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ben Hinkle schrieb:I've been converting the examples in http://home.comcast.net/~benhinkle/mintl/index.html to use this embedded html stuff and it works fine but I have one small issue. When I put the hidden code in HTML comments dmd can't find it. Is there an easy way to prevent some non-comment HTML from rendering in browsers? The reason I want to hide some code is that each example in the document is a code fragment and I have these ugly code blocks that wrap the fragments into a main(): <code> int main() { </code> .... rest of document ... <code> return 0; } </code> Writing text in the help to explain what those wacky code blocks are doing is ugly so I'd like to hide them from the user.<html> <head> <style type="text/css"> <!-- .hidden { display:none;visibility:inline; }; --> </style> </head> <body> <code class="hidden"> private import std.stdio; int main() { </code> <p>some documentation</p> <code> writef("Hello World!"); </code> <p>other comments</p> <code class="hidden"> return 0; } </code> </body> </html> Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDADuc3w+/yD4P9tIRAjVlAJ4/5XBfbWmu+rvdqtbHFn0I+h73agCfWr5x fs0l/Z8dkp4QEcS8yqqozXM= =ziQK -----END PGP SIGNATURE-----
Aug 14 2005
Ben Hinkle wrote:I've been converting the examples in http://home.comcast.net/~benhinkle/mintl/index.html to use this embedded html stuff and it works fine but I have one small issue. When I put the hidden code in HTML comments dmd can't find it. Is there an easy way to prevent some non-comment HTML from rendering in browsers? The reason I want to hide some code is that each example in the document is a code fragment and I have these ugly code blocks that wrap the fragments into a main(): <code> int main() { </code> .... rest of document ... <code> return 0; } </code> Writing text in the help to explain what those wacky code blocks are doing is ugly so I'd like to hide them from the user.<style type="text/css"> .hidden { display: none; } </style> <!-- ... --> <code class="hidden"> int main() { </code> .... rest of document ... <code class="hidden"> return 0; } </code><jmjmak utu.invalid.fi> wrote in message news:ddo2ir$2bbh$1 digitaldaemon.com...-- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/In article <ddo22b$2b1d$1 digitaldaemon.com>, Jarrett Billingsley says..."Ben Hinkle" <Ben_member pathlink.com> wrote in message news:ddnq6a$255k$1 digitaldaemon.com...On other hand, all this can be done automatically with tools like doxygen. I think there are some good things about html support. For example, it's very easy to test tutorial code found online by just compiling the web file. Still I don't think major projects should use this feature. It becomes quite cumbersome with bigger files. Jari-MattiI'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.I think it'd open up some interesting possibilities for IDEs. It'd be like combining the code with the docs - you could insert formatting, images, etc. interspersed with the code for docs.
Aug 26 2005
Jarrett Billingsley wrote:"Ben Hinkle" <Ben_member pathlink.com> wrote in message news:ddnq6a$255k$1 digitaldaemon.com...I would like this as well. I did some research to try and find a free HTML control that allows you to edit it. However the only free one seems to be part of the explorer it self (mozzila and iexplore has one). It would be great to be able to see images and such while your reading the code. You could highlight parts of importance, put things under headers ect... Upload it to the Internet. -JoelI'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.I think it'd open up some interesting possibilities for IDEs. It'd be like combining the code with the docs - you could insert formatting, images, etc. interspersed with the code for docs.
Feb 02 2007
janderson wrote:Jarrett Billingsley wrote:By HTML control I mean one that allows you to edit like a word doc. It would be highly impractical to code in straight HTML or XML."Ben Hinkle" <Ben_member pathlink.com> wrote in message news:ddnq6a$255k$1 digitaldaemon.com...I would like this as well. I did some research to try and find a free HTML control that allows you to edit it. However the only free one seems to be part of the explorer it self (mozzila and iexplore has one).I'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.I think it'd open up some interesting possibilities for IDEs. It'd be like combining the code with the docs - you could insert formatting, images, etc. interspersed with the code for docs.It would be great to be able to see images and such while your reading the code. You could highlight parts of importance, put things under headers ect... Upload it to the Internet. -Joel
Feb 02 2007
janderson Wrote: <snip>By HTML control I mean one that allows you to edit like a word doc. It would be highly impractical to code in straight HTML or XML.</snip> Like a word doc? If you're writing source code, you want it to be more like editing a plain text file, don't you? Unless you want to do the syntax highlighting manually. Writing the code, and then doing a search and replace to convert '&', '<' and '>' to their HTML equivalents doesn't strike me as impractical. Only when you want to do syntax highlighting does hand-coding begin to be cumbersome IMO. And even then, I can see some text editors having enough regexp power to lighten the load. TextPad has a "Copy as HTML" feature, and it makes it easy to add syntax highlighting using CSS. A few words of warning though: - TextPad is a commercial product - though it is fully functional TBYB (its creators don't use the word "shareware"....) - it isn't unicode conformant - it doesn't support D's nested comments or WYSIWYG strings - you'll have to manually add the <code> </code> tags afterwards - you might have to switch off word wrap, particularly if you have it set to break lines on save Stewart.
Feb 03 2007
Stewart Gordon wrote:janderson Wrote: <snip>I'd imagine if you had a control that you could make into your own editor, syntax hightlighting would be automatic. You could probably override it if necessary.By HTML control I mean one that allows you to edit like a word doc. It would be highly impractical to code in straight HTML or XML.</snip> Like a word doc? If you're writing source code, you want it to be more like editing a plain text file, don't you? Unless you want to do the syntax highlighting manually.When you've got HTML to worry about (particularly with syntax highlighting) its yet area for potential syntax bugs. You've also got more syntax to read and debug. The whole point is readability, I'm never going to look at code in html viewer, so why have all the ugly '<' and '>' and use my imagination to see the pictures and lines are.Writing the code, and then doing a search and replace to convert '&', '<' and '>' to their HTML equivalents doesn't strike me as impractical. Only when you want to do syntax highlighting does hand-coding begin to be cumbersome IMO. And even then, I can see some text editors having enough regexp power to lighten the load.TextPad has a "Copy as HTML" feature, and it makes it easy to add syntax highlighting using CSS. A few words of warning though: - TextPad is a commercial product - though it is fully functional TBYB (its creators don't use the word "shareware"....) - it isn't unicode conformant - it doesn't support D's nested comments or WYSIWYG stringsWhat's the point then?- you'll have to manually add the <code> </code> tags afterwards - you might have to switch off word wrap, particularly if you have it set to break lines on saveI checked out TextPad. It doesn't provide WYSIWYG strings, its not a control which I could fashion into my own editor (that provides context sensitivity ect..). I might as well use scintilla (which is a control). The main point of what I was taking about was WYSIWYG strings and images. I've a feeling that the control I want just doesn't exist. Thanks for your time.Stewart.
Feb 03 2007
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 janderson schrieb am 2007-02-04:Stewart Gordon wrote:janderson Wrote:For nice source code use the XHTML template below: 1 : <?xml version="1.0" encoding="utf-8"?> 2 : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 3 : "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 : <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> 5 : <head><title>XHTML Example</title></head> 6 : <body><pre><code><![CDATA[ 7 : if(x < 0 || "<a>b" != y) .... 8 : ]]></code></pre></body> 9 : </html> Some browsers require the file ending "xhtml" instead of "html". Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFxUALLK5blCcjpWoRAhH2AJ4yN8oSlGUuZHbsmKw5O/h60ZgOUgCeMQmM FfCyZakoJZXT5gT+Fj3hzVI= =P86C -----END PGP SIGNATURE-----When you've got HTML to worry about (particularly with syntax highlighting) its yet area for potential syntax bugs. You've also got more syntax to read and debug. The whole point is readability, I'm never going to look at code in html viewer, so why have all the ugly '<' and '>' and use my imagination to see the pictures and lines are.Writing the code, and then doing a search and replace to convert '&', '<' and '>' to their HTML equivalents doesn't strike me as impractical. Only when you want to do syntax highlighting does hand-coding begin to be cumbersome IMO. And even then, I can see some text editors having enough regexp power to lighten the load.
Feb 03 2007
In article <ddnq6a$255k$1 digitaldaemon.com>, Ben Hinkle says...I'm curious if anyone has been using the D feature of embedding D code in html and if so what are the benefits and problems? It seems to me like a neat idea that hasn't panned out - it doesn't seem practical. Then again I haven't used it except playing around with a file or two.I'm in the same boat, I've given it a few tries. It does seem like a cool way to document your code, but it falls short of its original purpose. Maybe its a bit nitpicky but the lack of an alternate extension, hurts when you're trying to groom your filesystem. Ideally, it should be something that says "I'm sourcecode embedded in markup" rather than "I'm a webpage, no, really." Extensions like "htmld" or "xmld" come to mind ("dhtml" is a bad idea for obvious reasons). Seeing a folder full of "html" files just looks too much like one of my web projects. Alternatively, If I could kick the parser into markup mode at will, (say via a pragma), that would be nice too. Now, I suppose one were to think outside the box, and treat these files not as HTML but XML files (data, not presentation), you could really take it somewhere. Now *that's* a little more useful. - EricAnderton at yahoo
Aug 14 2005