Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread 'Royall Spence' via Racket Users
I'd enjoy a #lang that parses Jinja templates. They've proliferated to all the major web languages and work nicely, so a Racketized version seems like an obvious upgrade. On Thu, Jan 4, 2018, at 3:23 PM, Matthew Butterick wrote: > >> On Jan 4, 2018, at 11:47 AM, Jay McCarthy >>

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Matthew Butterick
> On Jan 4, 2018, at 11:47 AM, Jay McCarthy wrote: > > FWIW, txexpr is essentially just `xexpr->string` but it sees when you > put in a `script` or `style` and it puts the `make-cdata` for you. (It > also does a bit more checking to make sure the xexpr is well-formed.)

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Neil Van Dyke
David Storrs wrote on 01/04/2018 02:27 PM: [...] (xexp->html   (html->xexp "This is

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Jens Axel Søgaard
tor. 4. jan. 2018 kl. 17.48 skrev Matt Jadud : > > What is the best way to generate HTML from the webserver? I don't care > about XML vs. HTML; I just want the fastest path to writing a small web > application that solves a problem that I have, and part of that means > easily

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Jay McCarthy
FWIW, txexpr is essentially just `xexpr->string` but it sees when you put in a `script` or `style` and it puts the `make-cdata` for you. (It also does a bit more checking to make sure the xexpr is well-formed.) On Thu, Jan 4, 2018 at 2:30 PM, Philip McGrath wrote: >

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Philip McGrath
(For posterity, because I realized I didn't explicitly say this:) The cdata structure effectively just tells functions like `write-xexpr` to write the string it contains without any escaping. In particular, it doesn't add the "" implied by using CDATA in actual XML, which is what we take

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread David Storrs
Speaking of the html-writing module, I noticed this in the docs: (xexp->html > (html->xexp > "This is > [Result is:] "This isbold italic text." > That does not seem like a correct result. "

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Norman Gray
Greetings. On 4 Jan 2018, at 19:07, Philip McGrath wrote: > P.S.: I was very comfortable reading and writing HTML and XML-ish notation > long before I came to Racket, and I initially resisted giving up my > angle-brackets (to the extent of fiddling around with reader extensions), > but I have

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Matt Jadud
Many thanks for all of the responses. I have no fear of the parentheses, and will likely end up with a number of wrappers like you describe, Phillip. I hadn't (yet) twigged to possibly wrapping things up in a CDATA section, but that makes sense. Now if we just had a Racket library that shoveled

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Philip McGrath
FWIW, I use `response/xexpr` in production with a `#:preamble` of `#"\n"`, and I haven't run into problems. The biggest non-obvious thing, since I see you're generating a script element, is that `response/xexpr` (and the underlying `xexpr->string`/` write-xexpr`) properly escape < and & in body

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread David Storrs
What would the characteristics of the perfect library be? Some easy things that come to mind: - automatically generate the boilerplate -- DTD, tags, etc - convenient methods for converting a LoL into a table - able to "literate assemble" template fragments from the disk On Thu, Jan 4, 2018 at

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Jay McCarthy
I don't think the perfect library exists, because HTML has changed considerably since most Racket libraries were written. I think xexpr do 90% of the job, but fails on the issues mentioned in that issue. I think the best option right now is either txexpr ---