0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-27 09:32:52 +00:00

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

This commit is contained in:
Carsten Dominik 2009-10-27 09:19:02 +01:00
commit a3bf897d46
2 changed files with 21 additions and 18 deletions

View file

@ -74,8 +74,8 @@ options and are taken from `org-babel-defualt-inline-header-args'."
(replacement (save-match-data
(org-babel-exp-do-export
(first info) (second info) (third info) 'inline))))
(setq end (+ end (- (length replacement) (length (match-string 0)))))
(replace-match replacement t t)))))
(setq end (+ end (- (length replacement) (length (match-string 1)))))
(replace-match replacement t t nil 1)))))
(defun org-babel-exp-lob-one-liners (start end)
"Process #+lob (Library of Babel) calls between START and END for export.
@ -104,13 +104,13 @@ options are taken from `org-babel-default-header-args'."
(defun org-babel-exp-do-export (lang body params type)
(case (intern (or (cdr (assoc :exports params)) "code"))
('none "")
('code (org-babel-exp-code body lang params type))
('results (org-babel-exp-results body lang params type))
('both (concat (org-babel-exp-code body lang params type)
('code (org-babel-exp-code lang body params type))
('results (org-babel-exp-results lang body params type))
('both (concat (org-babel-exp-code lang body params type)
"\n\n"
(org-babel-exp-results body lang params type)))))
(org-babel-exp-results lang body params type)))))
(defun org-babel-exp-code (body lang params type)
(defun org-babel-exp-code (lang body params type)
(case type
('inline (format "=%s=" body))
('block (format "#+BEGIN_SRC %s\n%s%s\n#+END_SRC" lang body
@ -120,7 +120,7 @@ options are taken from `org-babel-default-header-args'."
(format "#+BEGIN_SRC org-babel-lob\n%s\n#+END_SRC"
(first (org-babel-lob-get-info)))))))
(defun org-babel-exp-results (body lang params type)
(defun org-babel-exp-results (lang body params type)
(let ((params
;; lets ensure that we lookup references in the original file
(mapcar (lambda (pair)
@ -143,8 +143,10 @@ options are taken from `org-babel-default-header-args'."
((member "code" result-params)
(format "src_%s{%s}" lang raw))
(t
(if (and (stringp raw) (= 0 (length raw)))
" =(no results)= " (format " =%S= " raw))))))
(if (stringp raw)
(if (= 0 (length raw)) "=(no results)="
(format "=%s=" raw))
(format "=%S=" raw))))))
('block
(save-excursion ;; org-exp-blocks places us at the end of the block
(re-search-backward org-babel-src-block-regexp nil t)

View file

@ -109,17 +109,19 @@ then run `org-babel-pop-to-session'."
(defun org-babel-set-interpreters (var value)
(set-default var value)
(setq org-babel-src-block-regexp
(concat "^[ \t]*#\\+begin_src \\("
(concat "^[ \t]*#\\+begin_src[ \t]+\\("
(mapconcat 'regexp-quote value "\\|")
"\\)[ \t]*"
"\\([ \t]+\\([^\n]+\\)\\)?\n" ;; match header arguments
"\\([^\000]+?\\)#\\+end_src"))
(setq org-babel-inline-src-block-regexp
(concat "[ \t\n]src_\\("
(concat "[ \f\t\n\r\v]\\(src_" ;; (1) replacement target
"\\(" ;; (2) lang
(mapconcat 'regexp-quote value "\\|")
"\\)"
"\\(\\|\\[\\(.*\\)\\]\\)"
"{\\([^\n]+\\)}\\(?:[ \t\n]\\|\\'\\)")))
"\\(\\|\\[\\(.*\\)\\]\\)" ;; (3,4) (unused, headers)
"{\\([^\f\n\r\v]+\\)}" ;; (5) body
"\\)")))
(defun org-babel-add-interpreter (interpreter)
"Add INTERPRETER to `org-babel-interpreters' and update
@ -333,7 +335,6 @@ of the following form. (language body header-arguments-alist)"
(save-excursion (goto-char head) (org-babel-parse-src-block-match))
(if (save-excursion ;; inline source block
(re-search-backward "[ \f\t\n\r\v]" nil t)
(forward-char 1)
(looking-at org-babel-inline-src-block-regexp))
(org-babel-parse-inline-src-block-match)
nil)))) ;; indicate that no source block was found
@ -388,15 +389,15 @@ may be specified in the properties of the current outline entry."
(org-babel-parse-header-arguments (org-babel-clean-text-properties (or (match-string 3) "")))))))
(defun org-babel-parse-inline-src-block-match ()
(let* ((lang (org-babel-clean-text-properties (match-string 1)))
(let* ((lang (org-babel-clean-text-properties (match-string 2)))
(lang-headers (intern (concat "org-babel-default-header-args:" lang))))
(list lang
(org-babel-strip-protective-commas (org-babel-clean-text-properties (match-string 4)))
(org-babel-strip-protective-commas (org-babel-clean-text-properties (match-string 5)))
(org-babel-merge-params
org-babel-default-inline-header-args
(org-babel-params-from-properties)
(if (boundp lang-headers) (eval lang-headers) nil)
(org-babel-parse-header-arguments (org-babel-clean-text-properties (or (match-string 3) "")))))))
(org-babel-parse-header-arguments (org-babel-clean-text-properties (or (match-string 4) "")))))))
(defun org-babel-parse-header-arguments (arg-string)
"Parse a string of header arguments returning an alist."