【问题标题】:CGI Programming in Elisp?Elisp 中的 CGI 编程?
【发布时间】:2009-10-07 15:21:00
【问题描述】:

有没有人为 elisp 编写过任何库来进行 CGI 编程?我拼凑了一个快速的第一个脚本。但是,我只是一个长期使用 emacs 的用户,而且我从未真正编写过它。当我看到我可以在 emacs 中而不是 bash 中编写脚本(--script)时,我想我会试一试。

#!/usr/bin/emacs --script (princ "内容类型: text/html; charset=utf-8\n\n") (progn (princ "\n") (princ "\n") (princ "

Elisp CGI 编程

")) (progn (princ "") (princ "") (原理“”) (原则“
One Two
A B
”) (原则“”) (原则“

标签: emacs elisp


【解决方案1】:

This 可以帮到你,一个简单的 emacs 的 cgi 库

http://www.emacswiki.org/emacs/cgi.el

【讨论】:

    【解决方案2】:

    我没有写过任何 CGI 脚本,但是用xmlgen 来生成 xml。它可能比你在上面的更容易 - 因为在 Emacs 中生成列表并让它们自动转换为 xml/html 很容易。

    此代码生成相同的字符串:

    (require 'xmlgen)
    (princ  "Content-type: text/html; charset=utf-8\n\n")
    (princ (xmlgen '(html (body (h1 :style "text-align: center" "Elisp CGI Programming")
                          (table :style "border: 1px solid"
                                 (tr (th "One")
                                     (th "Two"))
                                 (tr (th "A")
                                     (th "B")))))))
    

    【讨论】:

    【解决方案3】:

    一种方法是使用 Emacs HttpServer 中的 httpd 服务器并使用代理向 emacs 发送请求。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多