wordsworth

org-mode 页面发布

 

Org-mode

 

Org-mode

1 Publishing Org-mode files to HTML

 

1.1 参考资料

为官网的一篇文章 Publishing Org-mode files to HTML.

1.2 易错点总结

  • css 文件的位置是在 org 文件的开始的参数 #+STYLE 中指定的, 在这里只能用相对路径, 不能用绝对路径或~路径.
  • 使用 ELisp 脚本设置导出参数, 在这里为了复用脚本, 我在 ~/org 目录下新建了一个 .el 文件, 内容如下:
(require 'org-publish)
(setq org-publish-project-alist
      '(
       ;; ... add all the components here (see below)...
        ("org-notes"
         :base-directory "~/org/"
         :base-extension "org"
         :publishing-directory "~/org/public_html/"
         :recursive t
         :publishing-function org-publish-org-to-html
         :headline-levels 4             ; Just the default for this project.
         :auto-preamble t
         )
        ("org-static"
         :base-directory "~/org/img"
         :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
         :publishing-directory "~/org/public_html/"
         :recursive t
         :publishing-function org-publish-attachment
         )
        ("org" :components ("org-notes" "org-static"))
))
  • 再次强调 css 文件位置的写法:
    1. css/stylesheet.css suits the needs for a file in the root folder. Use
    2. ../css/stylesheet.css in a subfolder (first level),
    3. http://www.cnblogs.com/css/stylesheet.css for a file in a sub-sub-folder.

1.3 注意 publish.el 脚本的执行方法:

  1. Move to the end of the first line and press C-x C-e to load org-publish.
  2. Now go to the end of the last line and press C-x C-e again.
  3. Repeat the last step after every change to your org-publish-project-alist.

1.4 publish Org-mode files

  1. 执行 publish.el 中的脚本
  2. To publish your Org-mode files just type M-x org-publish-project RET org RET or use one of the shortcuts listed in the manual.
  3. (猜想)理解精华:执行第2步时输入的"org"的含义为 publish.el 中倒数第2行中的 "org".

1.5 理解核心

  • css 文件位置一定要用 . (即当前相对路径) 的方式书写.
  • 在 publish.el 中, 输出路径可以用 ~ (即用户相对路径) 的方式书写.

Date: 2011-12-11 23:34:34 CST

Author: Bing Chen

Org version 7.7 with Emacs version 23

Validate XHTML 1.0

posted on 2012-05-08 07:00  wordsworth  阅读(604)  评论(0)    收藏  举报

导航