diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-04-03 08:32:32 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-04-03 08:32:32 +0200 |
commit | 17856939c40926351ebf8c68fe8d4db01534515f (patch) | |
tree | 0272243c9e5c811d889f4c7ba51f856cb902f279 | |
parent | 42d3323f3611d2e6d2bc9a721446c6d2e4c8db52 (diff) | |
download | org-mode-17856939c40926351ebf8c68fe8d4db01534515f.tar.gz |
Fix 2 bugs in Docbook export
Patch by Baoqiu Cui
-rwxr-xr-x | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/org-docbook.el | 39 |
2 files changed, 32 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a035ae0..bd5aeae 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-04-03 Carsten Dominik <carsten.dominik@gmail.com> + + * org-docbook.el (org-docbook-do-expand): Fix bug with variable names. + (org-export-docbook-finalize-table): Make use of label for tables. + 2010-04-02 Carsten Dominik <carsten.dominik@gmail.com> * org-attach.el (org-attach-commit): Split on newlines. diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index 7c43211..9d89725 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -1259,13 +1259,13 @@ string, don't modify these." (if org-export-with-sub-superscripts (setq s (org-export-docbook-convert-sub-super s))) (if org-export-with-TeX-macros - (let ((start 0) wd rep ass) + (let ((start 0) wd rep) (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?" s start)) (if (get-text-property (match-beginning 0) 'org-protected s) (setq start (match-end 0)) (setq wd (match-string 1 s)) - (if (setq ass (org-entity-get-representation wd 'html)) + (if (setq rep (org-entity-get-representation wd 'html)) (setq s (replace-match rep t t s)) (setq start (+ start (length wd)))))))) s) @@ -1349,18 +1349,33 @@ string, don't modify these." (replace-match "")))) (defun org-export-docbook-finalize-table (table) - "Change TABLE to informaltable if caption does not exist. + "Clean up TABLE and turn it into DocBook format. +This function adds a label to the table if it is available, and +also changes TABLE to informaltable if caption does not exist. TABLE is a string containing the HTML code generated by `org-format-table-html' for a table in Org-mode buffer." - (if (string-match - "^<table \\(\\(.\\|\n\\)+\\)<caption></caption>\n\\(\\(.\\|\n\\)+\\)</table>" - table) - (replace-match (concat "<informaltable " - (match-string 1 table) - (match-string 3 table) - "</informaltable>") - nil nil table) - table)) + (let ((table-with-label label)) + ;; Get the label if it exists, and move it into the <table> element. + (setq table-with-label + (if (string-match + "^<table \\(\\(.\\|\n\\)+\\)<a name=\"\\(.+\\)\" id=\".+\"></a>\n\\(\\(.\\|\n\\)+\\)</table>" + table) + (replace-match (concat "<table xml:id=\"" (match-string 3 table) "\" " + (match-string 1 table) + (match-string 4 table) + "</table>") + nil nil table) + table)) + ;; Change <table> into <informaltable> if caption does not exist. + (if (string-match + "^<table \\(\\(.\\|\n\\)+\\)<caption></caption>\n\\(\\(.\\|\n\\)+\\)</table>" + table-with-label) + (replace-match (concat "<informaltable " + (match-string 1 table-with-label) + (match-string 3 table-with-label) + "</informaltable>") + nil nil table-with-label) + table-with-label))) ;; Note: This function is very similar to ;; org-export-html-convert-sub-super. They can be merged in the future. |