The Modal bootstrap script can be used to display the content of an external
file in a modal window. The magic line is:
#+O_BLOG_SOURCE: path/to/file [mode]
The org template shorcut is <os
TAB
. Two parameters might be used:
- The mandatory
/path/to/file
which is the path to the file from which
content should be read.
- The optional
mode
which could be determined by if omitted.
这是显示 README-zh.md
文件的示例:
# o-blog 快速入门
- 如何使用 [o-blog](https://github.com/renard/o-blog).
- [英文演示站点](http://renard.github.com/o-blog).
- [中文演示站点](http://exaos.github.com/o-blog).
## 快速入门指南
开始之前,你需要有:
- [emacs](http:www.gnu.org/s/emacs) (假设你已经有了)
- [org-mode](http://orgmode.org/) (同上)
如果没有这些程序,你应该先安装好它们。
### 设置
#### 使用 `el-get`
如果你使用 [el-get](https://github.com/dimitri/el-get), 安装很容易。你只需要将
`o-blog` 添加到 `el-get-sources` 中,然后执行 `M-x el-get-install o-blog`.
如果你的 `el-get` 版本为 4 或以上,你只需要执行: `M-x el-get-install o-blog`.
#### 手动设置
首先从 [Github](http://github.com) 克隆这个 *git* 源码仓库。
```
cd ~/.emacs.d
git clone https://github.com/renard/o-blog.git
```
将后面的代码添加到你的 `~/.emacs.d/init.el` 文件中:
```
(add-to-list 'load-path "~/.emacs.d/o-blog")
(require 'o-blog)
```
### 发布
打开文件 `~/.emacs.d/o-blog/example/sample.org` 然后执行 `M-x org-publish-blog`.
生成的站点将会自动发布在 `~/.emacs.d/o-blog/out` 目录下。
然后,详情参见 `example/out/blog/index.html` 及 `example/out/todo.html`.
这是显示 elisp 代码的示例:
;;; sample-init.el --- sample init file to be used to debug o-blog
;; Copyright © 2012 Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
;; Author: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
;; Keywords: emacs,
;; Created: 2012-03-20
;; Last changed: 2012-03-26 16:36:31
;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/
;; This file is NOT part of GNU Emacs.
;;; Commentary:
;;
;;; Code:
(defun ob-build-sample ()
(let* ((d default-directory)
(sample (format "%s/.emacs.d/o-blog/example/sample.org" d))
(debugger
(lambda (&rest debugger-args)
(let* ((trace (with-temp-buffer
(insert (with-output-to-string (backtrace)))
(beginning-of-buffer)
;; error begins on line 16
;; line stats with " signal(error ..."
(goto-line 16)
(goto-char (point-at-bol))
;; Remove null chars
(replace-regexp-in-string
(char-to-string 0) "^@"
(buffer-substring (point) (point-max))))))
(o-blog-bug-report trace))))
(debug-on-error t)
print-length print-level)
(add-to-list 'load-path (format "%s/.emacs.d/org-mode/lisp" d))
(add-to-list 'load-path (format "%s/.emacs.d/org-mode/contrib/lisp" d))
(add-to-list 'load-path (format "%s/.emacs.d/o-blog" d))
(require 'o-blog)
(print
(concat
(emacs-version) "\n"
(org-version) "\n"
(o-blog-version) "\n"))
(find-file sample)
(org-publish-blog sample)
(kill-emacs)))