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 --- http://docs.racket-lang.org/txexpr/index.html or html-writing --- http://docs.racket-lang.org/html-writing/index.html But I think the perfect system is yet to be done. (I think it would have elements of these two, plus css-expr, for instance.) Jay On Thu, Jan 4, 2018 at 11:48 AM, Matt Jadud <m...@jadud.com> wrote: > Hi all, > > I read through this issue: > > https://github.com/racket/racket/issues/577 > > and am in the "what is going on?" category of user when it comes to HTML > generation in Racket. What should I be using to generate responses from a > servlet? response/xexpr? Does that generate HTML I can use practically? Or, > doesn't it? > > I've spent a lot of time in the last few days chasing the generation of TOTP > URIs for use with apps like Authy/FreeOTP/etc. I finally realized that I'm > passing strings like > > otpauth://totp/handin:astud...@foo.edu?secret=NODOF&amp;issuer=handin&amp;algorithm=SHA1&amp;digits=6&amp;period=30 > > to the Javascript layer for QR encoding. This looks bad to me. > > 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 > generating HTML that does what I expect when I generate it. That is, > > (body > (div ((id "QRCODE"))) > (script ((type "text/javascript")) > ,(format "new > QRCode(document.getElementById('QRCODE'), '~a');" > (generate-otp-uri email secret))))) > > seems not to do what I expect, which in this case is causing some rather > subtle challenges to chase down. ("Why does my test for TOTP encoding pass > *here*, and generate numbers that match *this* app when I enter data by > hand, but fail in the same app when I read the QR code that I generated...") > > Pointers to relevant documentation appreciated. > > Cheers, > Matt > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- -=[ Jay McCarthy http://jeapostrophe.github.io ]=- -=[ Associate Professor PLT @ CS @ UMass Lowell ]=- -=[ Moses 1:33: And worlds without number have I created; ]=- -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.