August 26, 2005 Re: OT: hiding text in html [was Re: embedding D in html: practical?] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | 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... > >>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 >> >> > > > -- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/ |
February 02, 2007 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote:
> "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.
>
>
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.
-Joel
|
February 02, 2007 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to janderson | janderson wrote: > Jarrett Billingsley wrote: >> "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. >> > > > 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). 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. > > 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 |
February 03, 2007 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to janderson | 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.
|
February 04, 2007 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Stewart Gordon wrote: > 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. 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. > > 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. > 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. > 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 What'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 save > I 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. |
February 04, 2007 Re: embedding D in html: practical? | ||||
---|---|---|---|---|
| ||||
Posted in reply to janderson Attachments: | janderson schrieb am 2007-02-04: > Stewart Gordon wrote: >> janderson Wrote: >> > 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. >> > 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. 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 |
Copyright © 1999-2021 by the D Language Foundation