CL-WHO-like HTML templating for other languages?

前端 未结 9 1028
别那么骄傲
别那么骄傲 2020-12-10 04:44

Common Lisp guys have their CL-WHO, which makes HTML templating integrated with the \"main\" language thus making the task easier. For those who don\'t know CL-WHO, it looks

相关标签:
9条回答
  • 2020-12-10 05:30

    One of The Perl Foundation's current grant-sponsored projects (a lightweight web framework for Perl 6) has working Perl6 code that provides a similar interface:

    use Tags;
    say show {
        html {
            head { title { 'Tags Demo' } }
            body {
                outs "hi";
                ul :id<numberlist> {
                    outs "A list from one to ten:";
                    for 1..10 {
                        li :class<number>, { $_ }
                    }
                }
            }
        }
    }
    

    Browse or clone the current code on github.

    0 讨论(0)
  • 2020-12-10 05:33

    There is stan: An s-expression-like syntax for expressing xml in pure python, from Divmod's Nevow. I think it's kind of what you want. An example from the tutorial linked:

    t = T.table[
               T.tr[
                   T.td[ "Name:" ],
                   T.td[ original.name ]
               ],
               T.tr[
                   T.td[ "Email:" ],
                   T.td[T.a(href='mailto:%s' % original.email)[ original.email ] ]
               ],
               T.tr[
                   T.td[ "Password:" ],
                   T.td[ "******" ]
               ],
           ]
    
    0 讨论(0)
  • 2020-12-10 05:35

    Here is such thing for JavaScript. It looks like the following:

    T.div({ className: "content"},
          T.p("Some ", T.u("paragraph")),
          T.p("Another paragraph"))
    
    0 讨论(0)
提交回复
热议问题