Browse Source

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

Carsten Dominik 15 years ago
parent
commit
8628e6e8a8
3 changed files with 27 additions and 21 deletions
  1. 19 13
      contrib/babel/lisp/org-babel-exp.el
  2. 0 4
      contrib/babel/lisp/org-babel-lob.el
  3. 8 4
      lisp/org-exp.el

+ 19 - 13
contrib/babel/lisp/org-babel-exp.el

@@ -128,22 +128,28 @@ options are taken from `org-babel-default-header-args'."
 
 
 (defun org-babel-exp-code (info type)
 (defun org-babel-exp-code (info type)
   (let ((lang (first info))
   (let ((lang (first info))
-	(body (second info))
-	(switches (fourth info))
-	(name (fifth info))
-	(args (sixth info))
-	(function-def-line ""))
+        (body (second info))
+        (switches (fourth info))
+        (name (fifth info))
+        (args (mapcar #'cdr
+                      (remove-if-not (lambda (el) (eq :var (car el))) (third info)))))
     (case type
     (case type
-      ('inline (format "=%s=" (second info)))
+      ('inline (format "=%s=" body))
       ('block
       ('block
           (let ((str (format "#+BEGIN_SRC %s %s\n%s%s#+END_SRC\n" lang switches body
           (let ((str (format "#+BEGIN_SRC %s %s\n%s%s#+END_SRC\n" lang switches body
-                        (if (string-match "\n$" body) "" "\n"))))
-            (add-text-properties 0 (length str) (list 'org-caption name) str)
-            str))
-      ('lob (save-excursion
-	      (re-search-backward org-babel-lob-one-liner-regexp)
-	      (format "#+BEGIN_SRC org-babel-lob\n%s\n#+END_SRC"
-                      (first (org-babel-lob-get-info))))))))
+                             (if (string-match "\n$" body) "" "\n"))))
+            (add-text-properties 0 (length str)
+                                 (list 'org-caption
+                                       (format "%s(%s)"
+                                               name (mapconcat #'identity args ", ")))
+                                 str) str))
+      ('lob
+       (let ((call-line (and (string-match "results=" (car args))
+                             (substring (car args) (match-end 0)))))
+         (cond
+          ((eq backend 'html)
+           (format "\n#+HTML: <label class=\"org-src-name\">%s</label>\n" call-line))
+          ((t (format ": %s\n" call-line)))))))))
 
 
 (defun org-babel-exp-results (info type)
 (defun org-babel-exp-results (info type)
   (let ((lang (first info))
   (let ((lang (first info))

+ 0 - 4
contrib/babel/lisp/org-babel-lob.el

@@ -104,9 +104,5 @@ the word 'call'."
 		   (concat ":var results=" (mapconcat #'identity info " ")))))))
 		   (concat ":var results=" (mapconcat #'identity info " ")))))))
     (org-babel-execute-src-block nil (list "emacs-lisp" "results" params))))
     (org-babel-execute-src-block nil (list "emacs-lisp" "results" params))))
 
 
-(define-generic-mode org-babel-lob-mode
-  '("#") (list org-babel-function-def-export-keyword) nil nil nil
-  "Major mode for fontification of library of babel lines on export")
-
 (provide 'org-babel-lob)
 (provide 'org-babel-lob)
 ;;; org-babel-lob.el ends here
 ;;; org-babel-lob.el ends here

+ 8 - 4
lisp/org-exp.el

@@ -2456,12 +2456,16 @@ INDENT was the original indentation of the block."
 			(setq rtn
 			(setq rtn
                               (concat
                               (concat
                                (if caption
                                (if caption
-                                   (format "<label class=\"org-src-name\">%s  &equiv</label>"
-                                           caption)
+                                   (concat
+                                    "<div class=\"org-src-container\">"
+                                    (format
+                                     "<label class=\"org-src-name\">%s</label>"
+                                     caption))
                                  "")
                                  "")
                                (replace-match
                                (replace-match
-				   (format "<pre class=\"src src-%s\">\n" lang)
-                                t t rtn)))))
+                                (format "<pre class=\"src src-%s\">\n" lang)
+                                t t rtn)
+                               (if caption "</div>" "")))))
 		(if textareap
 		(if textareap
 		    (setq rtn (concat
 		    (setq rtn (concat
 			       (format "<p>\n<textarea cols=\"%d\" rows=\"%d\" overflow-x:scroll >\n"
 			       (format "<p>\n<textarea cols=\"%d\" rows=\"%d\" overflow-x:scroll >\n"