为什么`assoc'在这种情况下返回nil?

问题描述 投票:0回答:1

我正在尝试为Emacs org-mode编写一个Export Backend。此模式源自ox-latex.el Exporter。我希望Exporter将所有* .css和* .js文件嵌入到生成的.html文件中。

导出器运行,但在我的函数中没有给出任何输出,因为这

assoc(t (("readthedocs" ("css" "htmlize.css" "readtheorg.css") ("js" "readtheorg.js" "jquery.js" "bootstrap.js"))))

call(来自调试器)返回nil。

我在这里错过了什么?

任何帮助赞赏:)完整的代码可以在这里找到https://pastebin.com/N475Uk9Z

编辑:

(defconst org-static-html-themes
  '(("readthedocs" . (("css" . ("htmlize.css"
                                "readtheorg.css"))
                      ("js" . ("readtheorg.js"
                               "jquery.js"
                               "bootstrap.js"))))))

(defun org-static-html--build-head (info)
  "Return information for the <head>..</head> of the HTML output.
INFO is a plist used as a communication channel."
  (progn
    (debug)

    (org-element-normalize-string
     (concat
      (org-element-normalize-string (plist-get info :html-head))
      (org-element-normalize-string (plist-get info :html-head-extra))
      (org-element-normalize-string
       (mapconcat (lambda (css)
                    (org-static-html-inline-css
                     (concat org-static-html-resource-path "/css/" css)))
                  (cdr (assoc "css"
                              (assoc
                               (plist-get info :static-html-theme)
                               org-static-html-themes))) "\n"))))))

该函数应该获取与相应主题相关联的所有css文件,然后返回连接并包装在样式标记内。

我应该说我使用的是Emacs版本27.0.50。

elisp org-mode
1个回答
1
投票

您的关联列表只包含一个关联:"readthedocs"(("css" "htmlize.css" "readtheorg.css") ("js" "readtheorg.js" "jquery.js" "bootstrap.js"))之间。由于没有任何关联t(assoc t ...)返回nil

© www.soinside.com 2019 - 2024. All rights reserved.