Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 14, 2005 embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
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. |
August 14, 2005 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | "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. |
August 14, 2005 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | 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... >> 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. 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-Matti |
August 14, 2005 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmjmak | <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... >>> 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. > > 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-Matti 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. |
August 14, 2005 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | 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. # <method> # <description>This is my hello world method</description> # <code> # void foobar(){ writefln("hello world"); } # </code> # </method> Now *that's* a little more useful. - EricAnderton at yahoo |
August 14, 2005 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmjmak | > 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.
|
August 14, 2005 OT: hiding text in html [was Re: embedding D in html: practical?] | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmjmak | 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... >>> 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. > > 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-Matti > > |
August 15, 2005 Re: OT: hiding text in html [was Re: embedding D in html: practical?] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | 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
|
August 15, 2005 Re: OT: hiding text in html [was Re: embedding D in html: practical?] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dejan Lekic | "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.org > You 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? |
August 15, 2005 Re: OT: hiding text in html [was Re: embedding D in html: practical?] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle Attachments: | 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 |
Copyright © 1999-2021 by the D Language Foundation