From: greim <gr...@sc...> - 2011-09-09 18:11:31
|
Hi /klacke >> >> i am just males some very first steps with yaws and Erlang. >> >> In between i have understood theerlweb syntax , i hope. >> But converting 20 lines of html/xml to the bracket erlang/yaws syntax is >> a real hard job. >> > > > Some tricks, > > 1. If you already know exactly which html you want to send, do that > then, as > > {html, [....]} > > If you need to populate that html data with dynamic data, just do so, it > can be a deep list of chars, and binaries mixed. > > > {html, [<<"<form id=\"myform\" > action=\"http://www.nettz.de/Formular-Chef/Formular-Chef.cgi\" > method=post > enctype=\"multipart/form-data\"> > <fieldset> > <legend>Name</legend> > <fieldset class=">>, > > > ErlangVariable, > > <<".... more binary data">> > .... > ] > very helpful, i didn't know that i can mix html/ehtml > > The main advantage of the ehtml syntax is that it's really easy to > construct such terms, using map, list comprehesions etc. > > [{label, [{for, X}], Body} || X<- ["abc", "xyz"]] > > > Having fixed html chunks with "holes" that get filled in is > also very efficient. > yes, this i have seen in the e-store example, thats cool.. > > > 2. yaws_html:parse/1 transforms from html syntax into the somewhat > strange (but nice) ehtml > VERY GOOD thats works. But some small hint / possible improvement If you translate xhtml to ehtml with yaws_html:parse(Infile, Outfile) the generated text file has no period at the end. If you try to read the file again with {ok, [{ehtml, [Test]}]} = file:consult(Pfad2), it crashes. > > 3. There is a new exhtml mode that generates strict xhtml data > good to know > 4. Use the erlang-mode in emacs when editing the e[x]html structures > i am now 50 years old, up to now i was able to avoid emacs for 33 years...VAX EDT was worse enough ;-), but maybe. I tried the eclipse erl plugin, but eclipse itself is a monster, so i went back to mc editor + git. > > Good luck > thats what i need... Markus > /klacke > > > > > ------------------------------------------------------------------------------ > Why Cloud-Based Security and Archiving Make Sense > Osterman Research conducted this study that outlines how and why cloud > computing security and archiving is rapidly being adopted across the IT > space for its ease of implementation, lower cost, and increased > reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ > _______________________________________________ > Erlyaws-list mailing list > Erl...@li... > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > |