;;; org-docbook.el --- DocBook exporter for org-mode
;;
-;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;;
;; Emacs Lisp Archive Entry
;; Filename: org-docbook.el
-;; Version: 6.29c
+;; Version: 6.33x
;; Author: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
;; Keywords: org, wp, docbook
;; Description: Converts an org-mode buffer into DocBook
-;; $Id: org-docbook.el,v 1.1 2009/08/06 09:14:12 cdominik Exp $
;; URL:
;; This file is part of GNU Emacs.
]>
\"
-If you want to process DocBook documents without internet
+If you want to process DocBook documents without an Internet
connection, it is suggested that you download the required entity
file(s) and use system identifier(s) (external files) in the
DOCTYPE declaration."
:group 'org-export-docbook
:type 'string)
+;;; Hooks
+
+(defvar org-export-docbook-final-hook nil
+ "Hook run at the end of DocBook export, in the new buffer.")
+
;;; Autoload functions:
;;;###autoload
beg end t 'string))
(setq reg (buffer-substring beg end)
buf (get-buffer-create "*Org tmp*"))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(erase-buffer)
(insert reg)
(org-mode)
(org-set-local 'buffer-file-name
(with-current-buffer (buffer-base-buffer)
buffer-file-name))
- (error "Need a file name to be able to export.")))
+ (error "Need a file name to be able to export")))
(message "Exporting...")
(setq-default org-todo-line-regexp org-todo-line-regexp)
(rbeg (and region-p (region-beginning)))
(rend (and region-p (region-end)))
(subtree-p
- (if (plist-get opt-plist :ignore-subree-p)
+ (if (plist-get opt-plist :ignore-subtree-p)
nil
(when region-p
(save-excursion
;; Make targets to anchors. Note that currently FOP does not
;; seem to support <anchor> tags when generating PDF output,
;; but this can be used in DocBook --> HTML conversion.
- (while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
+ (setq start 0)
+ (while (string-match
+ "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line start)
(cond
+ ((get-text-property (match-beginning 1) 'org-protected line)
+ (setq start (match-end 1)))
((match-end 2)
(setq line (replace-match
(format "@<anchor xml:id=\"%s\"/>"
(unless (plist-get opt-plist :buffer-will-be-killed)
(normal-mode)
- (if (eq major-mode default-major-mode)
+ (if (eq major-mode (default-value 'major-mode))
(nxml-mode)))
;; Remove empty paragraphs and lists. Replace them with a
(goto-char (point-max))
(unless body-only
(insert "</article>"))
+ (run-hooks 'org-export-docbook-final-hook)
(or to-buffer (save-buffer))
(goto-char (point-min))
(or (org-export-push-to-kill-ring "DocBook")
(provide 'org-docbook)
+;; arch-tag: a24a127c-d365-4c2a-9e9b-f7dcb0ebfdc3
;;; org-docbook.el ends here