新手求助
我在学习使用 orgmode 生成项目文档,由于分散在多个文件中,所以使用 org-publish 来统一生成文件,并发布到指定目录中。我使用了如下代码:
(setq docs-base (concat (projectile-project-root) "docs/"))
(setq org-publish-project-alist
'(("org-notes"
:base-directory ,docs-base
:base-extension "org"
:publishing-directory ,(concat docs-base "output")
:html-head "<link rel=\"stylesheet\" href=\"css/org.css\"/>"
:html-head-include-default-style nil
:with-date nil
:time-stamp-file nil
:publishing-function org-html-publish-to-html
)
("org-static"
:base-directory ,(concat (docs-base "assets/"))
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|txt\\|asc"
:publishing-directory ,(concat docs-base "output/assets")
:recursive t
:publishing-function org-publish-attachment
)
("org" :components
("org-notes" "org-static"))))
(org-publish-all)
由于要指定项目目录,我使用了 (projectile-project-root) 来指定,然后 concat 上文档所在的相对目录,保存在变量 docs-base 中。写法我是参考的官方文档,官方推荐的博文和网上的资料,分别是
- Publishing (Org Mode Compact Guide)
- Publishing Org-mode files to HTML
- https://jgkamat.gitlab.io/blog/website1.html
奇怪的是,我的配置是报错: org-publish-get-base-files: Wrong type argument: stringp, (, docs-base) 我仔细比较了我和官方文档里的写法,是他的几个参数都是使用了常量string配置的所有路径,我使用常量string配置路径以后( :base-directory ) ,代码可以正常运行,但是换成变量就依旧报错。
然而更奇怪的是我参考的第三偏博文中,使用的也是变量,同样使用 “,” 运算符取出的变量值。我也是 elisp 新手,无法理解其中的问题。故来请教。
debug信息:
Debugger entered--Lisp error: (wrong-type-argument stringp (\, docs-base))
file-name-as-directory((\, docs-base))
org-publish-get-base-files(("org-notes" :base-directory (\, docs-base) :base-extension "org" :publishing-directory (\, (concat docs-base "output")) :html-head "<link rel=\"stylesheet\" href=\"css/org.css\"/>" :html-head-include-default-style nil :with-date nil :time-stamp-file nil :publishing-function org-html-publish-to-html))
org-publish-projects((("org-notes" :base-directory (\, docs-base) :base-extension "org" :publishing-directory (\, (concat docs-base "output")) :html-head "<link rel=\"stylesheet\" href=\"css/org.css\"/>" :html-head-include-default-style nil :with-date nil :time-stamp-file nil :publishing-function org-html-publish-to-html) ("org-static" :base-directory (\, (concat (docs-base "assets/"))) :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|txt\\|asc" :publishing-directory (\, (concat docs-base "output/assets")) :recursive t :publishing-function org-publish-attachment) ("org" :components ("org-notes" "org-static"))))
org-publish-all()
eval-buffer() ; Reading at buffer position 831
funcall-interactively(eval-buffer)
call-interactively(eval-buffer nil nil)
command-execute(eval-buffer)
- 我的 orgmode 版本:Org mode version 9.2.5 (9.2.5-1-gff6508-elpaplus @ c:/Users/gsj98/.emacs.d/elpa/develop/org-plus-contrib-20190812/)
- 系统 windows 10 64bit
- emacs 版本:26.2
- 使用配置:spacemacs 0.300
感谢各位高手