summaryrefslogtreecommitdiff
path: root/lisp/org/org-exp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/org/org-exp.el')
-rw-r--r--lisp/org/org-exp.el379
1 files changed, 206 insertions, 173 deletions
diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el
index 87ebfd20062..c3f27cf0e15 100644
--- a/lisp/org/org-exp.el
+++ b/lisp/org/org-exp.el
@@ -6,7 +6,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.35i
+;; Version: 7.01
;;
;; This file is part of GNU Emacs.
;;
@@ -26,11 +26,15 @@
;;
;;; Commentary:
+;;; Code:
+
(require 'org)
(require 'org-macs)
(require 'org-agenda)
(require 'org-exp-blocks)
+(require 'ob-exp)
(require 'org-src)
+
(eval-when-compile
(require 'cl))
@@ -42,6 +46,8 @@
(declare-function org-export-htmlize-region-for-paste "org-html" (beg end))
(declare-function htmlize-buffer "ext:htmlize" (&optional buffer))
(declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
+(declare-function org-table-cookie-line-p "org-table" (line))
+(declare-function org-table-colgroup-line-p "org-table" (line))
(autoload 'org-export-generic "org-export-generic" "Export using the generic exporter" t)
(defgroup org-export nil
"Options for exporting org-listings."
@@ -93,9 +99,10 @@ This works by starting up a separate Emacs process visiting the same file
and doing the export from there.
Not all export commands are affected by this - only the ones which
actually write to a file, and that do not depend on the buffer state.
-
+\\<org-mode-map>
If this option is nil, you can still get background export by calling
-`org-export' with a double prefix arg: `C-u C-u C-c C-e'.
+`org-export' with a double prefix arg: \
+\\[universal-argument] \\[universal-argument] \\[org-export].
If this option is t, the double prefix can be used to exceptionally
force an export command into the current process."
@@ -231,7 +238,7 @@ This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
"Format of section numbers for export.
The variable has two components.
1. A list of lists, each indicating a counter type and a separator.
- The counter type can be any of \"1\", \"A\", \"a\", \"I\", or \"a\".
+ The counter type can be any of \"1\", \"A\", \"a\", \"I\", or \"i\".
It causes causes numeric, alphabetic, or roman counters, respectively.
The separator is only used if another counter for a subsection is being
added.
@@ -446,35 +453,6 @@ This option can also be set with the +OPTIONS line, e.g. \"f:nil\"."
:group 'org-export-translation
:type 'boolean)
-(defcustom org-export-with-sub-superscripts t
- "Non-nil means interpret \"_\" and \"^\" for export.
-When this option is turned on, you can use TeX-like syntax for sub- and
-superscripts. Several characters after \"_\" or \"^\" will be
-considered as a single item - so grouping with {} is normally not
-needed. For example, the following things will be parsed as single
-sub- or superscripts.
-
- 10^24 or 10^tau several digits will be considered 1 item.
- 10^-12 or 10^-tau a leading sign with digits or a word
- x^2-y^3 will be read as x^2 - y^3, because items are
- terminated by almost any nonword/nondigit char.
- x_{i^2} or x^(2-i) braces or parenthesis do grouping.
-
-Still, ambiguity is possible - so when in doubt use {} to enclose the
-sub/superscript. If you set this variable to the symbol `{}',
-the braces are *required* in order to trigger interpretations as
-sub/superscript. This can be helpful in documents that need \"_\"
-frequently in plain text.
-
-Not all export backends support this, but HTML does.
-
-This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
- :group 'org-export-translation
- :type '(choice
- (const :tag "Always interpret" t)
- (const :tag "Only with braces" {})
- (const :tag "Never interpret" nil)))
-
(defcustom org-export-with-TeX-macros t
"Non-nil means interpret simple TeX-like macros when exporting.
For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
@@ -518,12 +496,6 @@ This option can also be set with the +OPTIONS line, e.g. \"::nil\"."
:group 'org-export-translation
:type 'boolean)
-(defcustom org-match-sexp-depth 3
- "Number of stacked braces for sub/superscript matching.
-This has to be set before loading org.el to be effective."
- :group 'org-export-translation
- :type 'integer)
-
(defgroup org-export-tables nil
"Options for exporting tables in Org-mode."
:tag "Org Export Tables"
@@ -702,7 +674,7 @@ modified) list.")
"LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE"
"LATEX_HEADER" "LATEX_CLASS"
"EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS"
- "KEYWORDS" "DESCRIPTION" "MACRO" "BIND")
+ "KEYWORDS" "DESCRIPTION" "MACRO" "BIND" "XSLT")
(mapcar 'car org-export-inbuffer-options-extra))))
p key val text options a pr style
latex-header latex-class macros letbind
@@ -738,6 +710,8 @@ modified) list.")
(setq options (concat val " " options)))
((string-equal key "BIND")
(push (read (concat "(" val ")")) letbind))
+ ((string-equal key "XSLT")
+ (setq p (plist-put p :xslt val)))
((string-equal key "LINK_UP")
(setq p (plist-put p :link-up val)))
((string-equal key "LINK_HOME")
@@ -873,7 +847,8 @@ in the background. This will be done only for commands that write
to a file. For details see the docstring of `org-export-run-in-background'.
The prefix argument ARG will be passed to the exporter. However, if
-ARG is a double universal prefix `C-u C-u', that means to inverse the
+ARG is a double universal prefix \\[universal-argument] \\[universal-argument], \
+that means to inverse the
value of `org-export-run-in-background'."
(interactive "P")
(let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background))
@@ -883,7 +858,7 @@ value of `org-export-run-in-background'."
\[1] only export the current subtree
\[SPC] publish enclosing subtree (with LaTeX_CLASS or EXPORT_FILE_NAME prop)
-\[a/n/u] export as ASCII/Latin-1/UFT-8 [A/N/U] to temporary buffer
+\[a/n/u] export as ASCII/Latin-1/UTF-8 [A/N/U] to temporary buffer
\[h] export as HTML [H] to temporary buffer [R] export region
\[b] export as HTML and open in browser
@@ -893,6 +868,8 @@ value of `org-export-run-in-background'."
\[D] export as DocBook [V] export as DocBook, process to PDF, and open
+\[j] export as TaskJuggler [J] ... and open
+
\[m] export as Freemind mind map
\[x] export as XOXO
\[g] export using Wes Hardaker's generic exporter
@@ -919,6 +896,8 @@ value of `org-export-run-in-background'."
(?g org-export-generic t)
(?D org-export-as-docbook t)
(?V org-export-as-docbook-pdf-and-open t)
+ (?j org-export-as-taskjuggler t)
+ (?J org-export-as-taskjuggler-and-open t)
(?m org-export-as-freemind t)
(?l org-export-as-latex t)
(?p org-export-as-pdf t)
@@ -1003,7 +982,7 @@ value of `org-export-run-in-background'."
(defvar org-export-id-target-alist nil
"Alist of section id's with preferred aliases.")
(defvar org-export-code-refs nil
- "Alist of code references and line numbers")
+ "Alist of code references and line numbers.")
(defun org-export-preprocess-string (string &rest parameters)
"Cleanup STRING so that that the true exported has a more consistent source.
@@ -1059,7 +1038,7 @@ on this string to produce the exported version."
(untabify (point-min) (point-max))
;; Handle include files, and call a hook
- (org-export-handle-include-files)
+ (org-export-handle-include-files-recurse)
(run-hooks 'org-export-preprocess-after-include-files-hook)
;; Get rid of archived trees
@@ -1187,6 +1166,9 @@ on this string to produce the exported version."
;; Remove or replace comments
(org-export-handle-comments (plist-get parameters :comments))
+ ;; Remove #+TBLFM and #+TBLNAME lines
+ (org-export-handle-table-metalines)
+
;; Run the final hook
(run-hooks 'org-export-preprocess-final-hook)
@@ -1205,43 +1187,48 @@ on this string to produce the exported version."
(defun org-export-define-heading-targets (target-alist)
"Find all headings and define the targets for them.
-The new targets are added to TARGET-ALIST, which is also returned."
+The new targets are added to TARGET-ALIST, which is also returned.
+Also find all ID and CUSTOM_ID properties and store them."
(goto-char (point-min))
(org-init-section-numbers)
(let ((re (concat "^" org-outline-regexp
- "\\| [ \t]*:\\(ID\\|CUSTOM_ID\\):[ \t]*\\([^ \t\r\n]+\\)"))
+ "\\|"
+ "^[ \t]*:\\(ID\\|CUSTOM_ID\\):[ \t]*\\([^ \t\r\n]+\\)"))
level target last-section-target a id)
(while (re-search-forward re nil t)
- (if (match-end 2)
- (progn
- (setq id (org-match-string-no-properties 2))
- (push (cons id target) target-alist)
- (setq a (or (assoc last-section-target org-export-target-aliases)
- (progn
- (push (list last-section-target)
- org-export-target-aliases)
- (car org-export-target-aliases))))
- (push (caar target-alist) (cdr a))
- (when (equal (match-string 1) "CUSTOM_ID")
- (if (not (assoc last-section-target
- org-export-preferred-target-alist))
- (push (cons last-section-target id)
- org-export-preferred-target-alist)))
- (when (equal (match-string 1) "ID")
- (if (not (assoc last-section-target
- org-export-id-target-alist))
- (push (cons last-section-target (concat "ID-" id))
- org-export-id-target-alist))))
- (setq level (org-reduced-level
- (save-excursion (goto-char (point-at-bol))
- (org-outline-level))))
- (setq target (org-solidify-link-text
- (format "sec-%s" (org-section-number level))))
- (setq last-section-target target)
- (push (cons target target) target-alist)
- (add-text-properties
- (point-at-bol) (point-at-eol)
- (list 'target target)))))
+ (org-if-unprotected-at (match-beginning 0)
+ (if (match-end 2)
+ (progn
+ (setq id (org-match-string-no-properties 2))
+ (push (cons id target) target-alist)
+ (setq a (or (assoc last-section-target org-export-target-aliases)
+ (progn
+ (push (list last-section-target)
+ org-export-target-aliases)
+ (car org-export-target-aliases))))
+ (push (caar target-alist) (cdr a))
+ (when (equal (match-string 1) "CUSTOM_ID")
+ (if (not (assoc last-section-target
+ org-export-preferred-target-alist))
+ (push (cons last-section-target id)
+ org-export-preferred-target-alist)))
+ (when (equal (match-string 1) "ID")
+ (if (not (assoc last-section-target
+ org-export-id-target-alist))
+ (push (cons last-section-target (concat "ID-" id))
+ org-export-id-target-alist))))
+ (setq level (org-reduced-level
+ (save-excursion (goto-char (point-at-bol))
+ (org-outline-level))))
+ (setq target (org-solidify-link-text
+ (format "sec-%s" (replace-regexp-in-string
+ "\\." "_"
+ (org-section-number level)))))
+ (setq last-section-target target)
+ (push (cons target target) target-alist)
+ (add-text-properties
+ (point-at-bol) (point-at-eol)
+ (list 'target target))))))
target-alist)
(defun org-export-handle-invisible-targets (target-alist)
@@ -1338,9 +1325,9 @@ the current file."
(defvar org-export-format-drawer-function nil
"Function to be called to format the contents of a drawer.
The function must accept three parameters:
- BACKEND one of the symbols html, docbook, latex, ascii, xoxo
NAME the drawer name, like \"PROPERTIES\"
CONTENT the content of the drawer.
+ BACKEND one of the symbols html, docbook, latex, ascii, xoxo
The function should return the text to be inserted into the buffer.
If this is nil, `org-export-format-drawer' is used as a default.")
@@ -1547,15 +1534,25 @@ from the buffer."
(while formatters
(setq fmt (pop formatters))
- (when (eq (car fmt) backend)
- ;; This is selected code, put it into the file for real
- (goto-char (point-min))
- (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
- ":[ \t]*\\(.*\\)") nil t)
+ ;; Handle #+Backend: stuff
+ (goto-char (point-min))
+ (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
+ ":[ \t]*\\(.*\\)") nil t)
+ (if (not (eq (car fmt) backend))
+ (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
(replace-match "\\1\\2" t)
(add-text-properties
(point-at-bol) (min (1+ (point-at-eol)) (point-max))
'(org-protected t))))
+ ;; Delete #+attr_Backend: stuff of another backend. Those
+ ;; matching the current backend will be taken care of by
+ ;; `org-export-attach-captions-and-attributes'
+ (goto-char (point-min))
+ (while (re-search-forward (concat "^\\([ \t]*\\)#\\+attr_" (cadr fmt)
+ ":[ \t]*\\(.*\\)") nil t)
+ (when (not (eq (car fmt) backend))
+ (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
+ ;; Handle #+begin_Backend and #+end_Backend stuff
(goto-char (point-min))
(while (re-search-forward (concat "^[ \t]*#\\+" (caddr fmt) "\\>.*\n?")
nil t)
@@ -1589,8 +1586,8 @@ These special cookies will later be interpreted by the backend."
(setq beg (match-beginning 0)
beg1 (1+ (match-end 0)))
(when (re-search-forward (concat "^[ \t]*#\\+end_" type "\\>.*") nil t)
- (setq end (1+ (point-at-eol))
- end1 (1- (match-beginning 0)))
+ (setq end1 (1- (match-beginning 0))
+ end (+ (point-at-eol) (if (looking-at "\n$") 1 0)))
(setq content (org-remove-indentation (buffer-substring beg1 end1)))
(setq content (concat "ORG-" (upcase t1) "-START\n"
content "\n"
@@ -1615,15 +1612,24 @@ table line. If it is a link, add it to the line containing the link."
"^[ \t]*\\(|[^-]\\)"
"\\|"
"^[ \t]*\\[\\[.*\\]\\][ \t]*$"))
- cap attr label end)
+ cap shortn attr label end)
(while (re-search-forward re nil t)
(cond
((match-end 1)
- (setq cap (concat cap (if cap " " "") (org-trim (match-string 1)))))
+ (progn
+ (setq cap (concat cap (if cap " " "") (org-trim (match-string 1))))
+ (when (string-match "\\[\\(.*\\)\\]{\\(.*\\)}" cap)
+ (setq shortn (match-string 1 cap)
+ cap (match-string 2 cap)))
+ (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
((match-end 2)
- (setq attr (concat attr (if attr " " "") (org-trim (match-string 2)))))
+ (progn
+ (setq attr (concat attr (if attr " " "") (org-trim (match-string 2))))
+ (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
((match-end 3)
- (setq label (org-trim (match-string 3))))
+ (progn
+ (setq label (org-trim (match-string 3)))
+ (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
(t
(setq end (if (match-end 4)
(let ((ee (org-table-end)))
@@ -1631,6 +1637,7 @@ table line. If it is a link, add it to the line containing the link."
(point-at-eol)))
(add-text-properties (point-at-bol) end
(list 'org-caption cap
+ 'org-caption-shortn shortn
'org-attributes attr
'org-label label))
(if label (push (cons label label) target-alist))
@@ -1659,21 +1666,36 @@ table line. If it is a link, add it to the line containing the link."
"Remove comments, or convert to backend-specific format.
COMMENTSP can be a format string for publishing comments.
When it is nil, all comments will be removed."
- (let ((re "^\\(#\\|[ \t]*#\\+\\)\\(.*\n?\\)")
+ (let ((re "^\\(#\\|[ \t]*#\\+ \\)\\(.*\n?\\)")
+ pos)
+ (goto-char (point-min))
+ (while (or (looking-at re)
+ (re-search-forward re nil t))
+ (setq pos (match-beginning 0))
+ (if (get-text-property pos 'org-protected)
+ (goto-char (1+ pos))
+ (if (and commentsp
+ (not (equal (char-before (match-end 1)) ?+)))
+ (progn (add-text-properties
+ (match-beginning 0) (match-end 0) '(org-protected t))
+ (replace-match (format commentsp (match-string 2)) t t))
+ (goto-char (1+ pos))
+ (replace-match "")
+ (goto-char (max (point-min) (1- pos))))))))
+
+(defun org-export-handle-table-metalines ()
+ "Remove table specific metalines #+TBLNAME: and #+TBLFM:."
+ (let ((re "^[ \t]*#\\+TBL\\(NAME\\|FM\\):\\(.*\n?\\)")
pos)
(goto-char (point-min))
(while (or (looking-at re)
(re-search-forward re nil t))
(setq pos (match-beginning 0))
- (if (and commentsp
- (not (equal (char-before (match-end 1)) ?+)))
- (progn (add-text-properties
- (match-beginning 0) (match-end 0) '(org-protected t))
- (replace-match (format commentsp (match-string 2)) t t))
+ (if (get-text-property (point) 'org-protected)
+ (goto-char (1+ pos))
(goto-char (1+ pos))
- (org-if-unprotected
- (replace-match "")
- (goto-char (max (point-min) (1- pos))))))))
+ (replace-match "")
+ (goto-char (max (point-min) (1- pos)))))))
(defun org-export-mark-radio-links ()
"Find all matches for radio targets and turn them into internal links."
@@ -1694,22 +1716,23 @@ When it is nil, all comments will be removed."
"Remove tables lines that are used for internal purposes."
(goto-char (point-min))
(while (re-search-forward "^[ \t]*|" nil t)
- (beginning-of-line 1)
- (if (or (looking-at "[ \t]*| *[!_^] *|")
- (not
- (memq
- nil
- (mapcar
- (lambda (f)
- (or (= (length f) 0)
- (string-match
- "\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f)))
- (org-split-string ;; FIXME, can't we do this without splitting???
- (buffer-substring (point-at-bol) (point-at-eol))
- "[ \t]*|[ \t]*")))))
- (delete-region (max (point-min) (1- (point-at-bol)))
- (point-at-eol))
- (end-of-line 1))))
+ (org-if-unprotected-at (1- (point))
+ (beginning-of-line 1)
+ (if (or (looking-at "[ \t]*| *[!_^] *|")
+ (not
+ (memq
+ nil
+ (mapcar
+ (lambda (f)
+ (or (= (length f) 0)
+ (string-match
+ "\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f)))
+ (org-split-string ;; FIXME, can't we do without splitting???
+ (buffer-substring (point-at-bol) (point-at-eol))
+ "[ \t]*|[ \t]*")))))
+ (delete-region (max (point-min) (1- (point-at-bol)))
+ (point-at-eol))
+ (end-of-line 1)))))
(defun org-export-protect-sub-super (s)
(save-match-data
@@ -1990,7 +2013,7 @@ TYPE must be a string, any of:
(defun org-export-handle-include-files ()
"Include the contents of include files, with proper formatting."
(let ((case-fold-search t)
- params file markup lang start end prefix prefix1 switches)
+ params file markup lang start end prefix prefix1 switches all)
(goto-char (point-min))
(while (re-search-forward "^#\\+INCLUDE:?[ \t]+\\(.*\\)" nil t)
(setq params (read (concat "(" (match-string 1) ")"))
@@ -2007,6 +2030,7 @@ TYPE must be a string, any of:
(not (file-exists-p file))
(not (file-readable-p file)))
(insert (format "CANNOT INCLUDE FILE %s" file))
+ (setq all (cons file all))
(when markup
(if (equal (downcase markup) "src")
(setq start (format "#+begin_src %s %s\n"
@@ -2019,7 +2043,20 @@ TYPE must be a string, any of:
(insert (org-get-file-contents (expand-file-name file)
prefix prefix1 markup))
(or (bolp) (newline))
- (insert (or end ""))))))
+ (insert (or end ""))))
+ all))
+
+(defun org-export-handle-include-files-recurse ()
+ "Recursively include files aborting on circular inclusion."
+ (let ((now (list org-current-export-file)) all)
+ (while now
+ (setq all (append now all))
+ (setq now (org-export-handle-include-files))
+ (let ((intersection
+ (delq nil
+ (mapcar (lambda (el) (when (member el all) el)) now))))
+ (when intersection
+ (error "Recursive #+INCLUDE: %S" intersection))))))
(defun org-get-file-contents (file &optional prefix prefix1 markup)
"Get the contents of FILE and return them as a string.
@@ -2034,7 +2071,7 @@ take care of the block they are in."
(goto-char (point-min))
(while (not (eobp))
(insert (or prefix1 prefix))
- (setq prefix1 nil)
+ (setq prefix1 "")
(beginning-of-line 2)))
(buffer-string)
(when (member markup '("src" "example"))
@@ -2075,19 +2112,29 @@ in the list) and remove property and value from the list in LISTVAR."
lang code trans opts indent caption)
(goto-char (point-min))
(while (re-search-forward
- "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)"
+ "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?\\([ \t]+\\([^ \t\n]+\\)\\)?\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)"
nil t)
(if (match-end 1)
- ;; src segments
- (setq lang (match-string 3)
- opts (match-string 4)
- code (match-string 5)
- indent (length (match-string 2))
- caption (get-text-property 0 'org-caption (match-string 0)))
+ (if (not (match-string 4))
+ (error "Source block missing language specification: %s"
+ (let* ((body (match-string 6))
+ (nothing (message "body:%s" body))
+ (preview (or (and (string-match
+ "^[ \t]*\\([^\n\r]*\\)" body)
+ (match-string 1 body)) body)))
+ (if (> (length preview) 35)
+ (concat (substring preview 0 32) "...")
+ preview)))
+ ;; src segments
+ (setq lang (match-string 4)
+ opts (match-string 5)
+ code (match-string 6)
+ indent (length (match-string 2))
+ caption (get-text-property 0 'org-caption (match-string 0))))
(setq lang nil
- opts (match-string 8)
- code (match-string 9)
- indent (length (match-string 7))
+ opts (match-string 9)
+ code (match-string 10)
+ indent (length (match-string 8))
caption (get-text-property 0 'org-caption (match-string 0))))
(setq trans (org-export-format-source-code-or-example
@@ -2153,12 +2200,14 @@ INDENT was the original indentation of the block."
(org-add-props (concat "<programlisting><![CDATA["
rtn
"]]></programlisting>\n")
- '(org-protected t))
+ '(org-protected t org-example t))
"#+END_DOCBOOK\n"))
((eq backend 'html)
;; We are exporting to HTML
(when lang
- (require 'htmlize nil t)
+ (if (featurep 'xemacs)
+ (require 'htmlize)
+ (require 'htmlize nil t))
(when (not (fboundp 'htmlize-region-for-paste))
;; we do not have htmlize.el, or an old version of it
(setq lang nil)
@@ -2221,7 +2270,7 @@ INDENT was the original indentation of the block."
cont rpllbl fmt)))
(if (string-match "\\(\\`<[^>]*>\\)\n" rtn)
(setq rtn (replace-match "\\1" t nil rtn)))
- (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n"))
+ (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t org-example t)) "\n#+END_HTML\n\n"))
((eq backend 'latex)
(setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt))
(concat "#+BEGIN_LaTeX\n"
@@ -2245,7 +2294,7 @@ INDENT was the original indentation of the block."
rtn "\\end{lstlisting}\n")
(concat (car org-export-latex-verbatim-wrap)
rtn (cdr org-export-latex-verbatim-wrap)))
- '(org-protected t))
+ '(org-protected t org-example t))
"#+END_LaTeX\n"))
((eq backend 'ascii)
;; This is not HTML or LaTeX, so just make it an example.
@@ -2259,7 +2308,7 @@ INDENT was the original indentation of the block."
(org-split-string rtn "\n")
"\n")
"\n")
- '(org-protected t))
+ '(org-protected t org-example t))
"#+END_ASCII\n"))))
(org-add-props rtn nil 'original-indentation indent))))
@@ -2362,8 +2411,8 @@ INDENT was the original indentation of the block."
(defun org-export-visible (type arg)
"Create a copy of the visible part of the current buffer, and export it.
The copy is created in a temporary buffer and removed after use.
-TYPE is the final key (as a string) that also select the export command in
-the `C-c C-e' export dispatcher.
+TYPE is the final key (as a string) that also selects the export command in
+the \\<org-mode-map>\\[org-export] export dispatcher.
As a special case, if the you type SPC at the prompt, the temporary
org-mode file will not be removed but presented to you so that you can
continue to use it. The prefix arg ARG is passed through to the exporting
@@ -2490,7 +2539,8 @@ directory."
filename)))
(backup-inhibited t)
(buffer (find-file-noselect filename))
- (region (buffer-string)))
+ (region (buffer-string))
+ str-ret)
(save-excursion
(switch-to-buffer buffer)
(erase-buffer)
@@ -2536,7 +2586,11 @@ directory."
(write-file (concat filename ".html")))
(kill-buffer newbuf)))
(set-buffer-modified-p nil)
- (kill-buffer (current-buffer)))))
+ (if (equal to-buffer 'string)
+ (progn (setq str-ret (buffer-string))
+ (kill-buffer (current-buffer))
+ str-ret)
+ (kill-buffer (current-buffer))))))
(defvar org-archive-location) ;; gets loaded with the org-archive require.
(defun org-get-current-options ()
@@ -2558,6 +2612,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
#+EXPORT_EXCLUDE_TAGS: %s
#+LINK_UP: %s
#+LINK_HOME: %s
+#+XSLT:
#+CATEGORY: %s
#+SEQ_TODO: %s
#+TYP_TODO: %s
@@ -2650,13 +2705,16 @@ If yes remove the column and the special lines."
"^[ \t]*| *\\([\#!$*_^ /]\\) *|")
x)))
lines))
+ ;; No special marking column
(progn
(setq org-table-clean-did-remove-column nil)
(delq nil
(mapcar
(lambda (x)
(cond
- ((string-match "^[ \t]*| */ *|" x)
+ ((org-table-colgroup-line-p x)
+ ;; This line contains colgroup info, extract it
+ ;; and then discard the line
(setq org-table-colgroup-info
(mapcar (lambda (x)
(cond ((member x '("<" "&lt;")) :start)
@@ -2665,14 +2723,20 @@ If yes remove the column and the special lines."
(t nil)))
(org-split-string x "[ \t]*|[ \t]*")))
nil)
+ ((org-table-cookie-line-p x)
+ ;; This line contains formatting cookies, discard it
+ nil)
(t x)))
lines)))
+ ;; there is a special marking column
(setq org-table-clean-did-remove-column t)
(delq nil
(mapcar
(lambda (x)
(cond
- ((string-match "^[ \t]*| */ *|" x)
+ ((org-table-colgroup-line-p x)
+ ;; This line contains colgroup info, extract it
+ ;; and then discard the line
(setq org-table-colgroup-info
(mapcar (lambda (x)
(cond ((member x '("<" "&lt;")) :start)
@@ -2681,8 +2745,12 @@ If yes remove the column and the special lines."
(t nil)))
(cdr (org-split-string x "[ \t]*|[ \t]*"))))
nil)
+ ((org-table-cookie-line-p x)
+ ;; This line contains formatting cookies, discard it
+ nil)
((string-match "^[ \t]*| *[!_^/] *|" x)
- nil) ; ignore this line
+ ;; ignore this line
+ nil)
((or (string-match "^\\([ \t]*\\)|-+\\+" x)
(string-match "^\\([ \t]*\\)|[^|]*|" x))
;; remove the first column
@@ -2704,41 +2772,6 @@ If yes remove the column and the special lines."
(setq s (replace-match "" t t s)))
s)
-(defun org-create-multibrace-regexp (left right n)
- "Create a regular expression which will match a balanced sexp.
-Opening delimiter is LEFT, and closing delimiter is RIGHT, both given
-as single character strings.
-The regexp returned will match the entire expression including the
-delimiters. It will also define a single group which contains the
-match except for the outermost delimiters. The maximum depth of
-stacked delimiters is N. Escaping delimiters is not possible."
- (let* ((nothing (concat "[^" left right "]*?"))
- (or "\\|")
- (re nothing)
- (next (concat "\\(?:" nothing left nothing right "\\)+" nothing)))
- (while (> n 1)
- (setq n (1- n)
- re (concat re or next)
- next (concat "\\(?:" nothing left next right "\\)+" nothing)))
- (concat left "\\(" re "\\)" right)))
-
-(defvar org-match-substring-regexp
- (concat
- "\\([^\\]\\)\\([_^]\\)\\("
- "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
- "\\|"
- "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
- "\\|"
- "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)")
- "The regular expression matching a sub- or superscript.")
-
-(defvar org-match-substring-with-braces-regexp
- (concat
- "\\([^\\]\\)\\([_^]\\)\\("
- "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
- "\\)")
- "The regular expression matching a sub- or superscript, forcing braces.")
-
(defun org-get-text-property-any (pos prop &optional object)
(or (get-text-property pos prop object)