Hi, I am trying to write a simple web app in scheme and I am using Drscheme for the job. I am wondering if there is a way to input html code into a form which then outputs it in html format (into source)? Is there a library that does the job? Everytime I input something it turns out as a string, I need it to be read as html. Can someone help me? Thanks in advance!
+1
A:
If you want to use HTML template files, then look at the templates in the web server manual. Also, in case you're not familiar with the web server, then see the web server guide for a good introduction.
Eli Barzilay
2009-07-21 05:46:07
I wonder if there is any way to go from html string to scheme html code. For example, "<html><head><title>My Blog</title></head><body><h1>under construction</h1></body></html>" to:'(html (head (title "My Blog")) (body (h1 "Under construction"))))
Mark
2009-07-21 06:18:43
Start with a "(" and then for every opening HTML tag "<" insert a "(" and a closing ")" for every HTML closing tag "</". The text remains same of course. You can take a look at the HTML parsing library: http://docs.plt-scheme.org/html/index.html
Amit
2009-07-21 06:31:01
in that case it would be: "(html)(head)(title)My Blog(title)(head)(body)(h1)under construction(h1)(body)(html) ?
Mark
2009-07-21 06:41:22
Note that I told for every closing "</ and not ">". I think that should work. Also note that you will have to "look ahead" of "<" and see the next character. If it is "/" then replace the two chars by a ")", else replace it by a "(".
Amit
2009-07-21 08:38:01
ok thx for the tip
Mark
2009-07-21 18:03:13
I am wondering how I can use the html parser to do this?
Mark
2009-07-21 18:05:16
Well, your question is not really too defined. If you mean how you can start with Scheme code *instead* of HTML code, and have it in a form that outputs HTML, then there are several frameworks that allow you to do that.If you're talking about starting from actual HTML, and parsing it into Scheme structures and then generate HTML from that, then that's possible too (there are several HTML parsers in PLT and in libraries), but I don't see the point there, since you'd end up with HTML that is equivalent to what you started with...
Eli Barzilay
2009-07-23 00:27:06