Browse Source

Merge branch 'master' of orgmode.org:org-mode

Bastien Guerry 13 years ago
parent
commit
8ad81bfda7
2 changed files with 34 additions and 21 deletions
  1. 7 9
      EXPERIMENTAL/org-e-latex.el
  2. 27 12
      contrib/lisp/org-export.el

+ 7 - 9
EXPERIMENTAL/org-e-latex.el

@@ -56,7 +56,7 @@ structure of the value.")
 
 ;;; User Configurable Variables
 
-(defgroup org-export-latex nil
+(defgroup org-export-e-latex nil
   "Options for exporting Org mode files to LaTeX."
   :tag "Org Export LaTeX"
   :group 'org-export)
@@ -411,8 +411,8 @@ package.  Just add these to `org-e-latex-packages-alist',
 for example using customize, or with something like
 
   (require 'org-e-latex)
-  (add-to-list 'org-export-latex-packages-alist '(\"\" \"listings\"))
-  (add-to-list 'org-export-latex-packages-alist '(\"\" \"color\"))
+  (add-to-list 'org-e-latex-packages-alist '(\"\" \"listings\"))
+  (add-to-list 'org-e-latex-packages-alist '(\"\" \"color\"))
 
 Alternatively,
 
@@ -467,7 +467,7 @@ These options are supplied as a comma-separated list to the
 a list containing two strings: the name of the option, and the
 value. For example,
 
-  (setq org-export-latex-listings-options
+  (setq org-e-latex-listings-options
     '((\"basicstyle\" \"\\small\")
       (\"keywordstyle\" \"\\color{black}\\bfseries\\underbar\")))
 
@@ -513,7 +513,7 @@ These options are supplied within square brackets in
 a list containing two strings: the name of the option, and the
 value. For example,
 
-  (setq org-export-latex-minted-options
+  (setq org-e-latex-minted-options
     '((\"bgcolor\" \"bg\") (\"frame\" \"lines\")))
 
 will result in src blocks being exported with
@@ -533,7 +533,7 @@ options will be applied to blocks of all languages."
 environments used during export of src blocks by the listings and
 minted latex packages. For example,
 
-  (setq org-export-latex-custom-lang-environments
+  (setq org-e-latex-custom-lang-environments
      '((python \"pythoncode\")))
 
 would have the effect that if org encounters begin_src python
@@ -1040,9 +1040,7 @@ holding contextual information."
      ;; Case 2. This is a deep sub-tree: export it as a list item.
      ;;         Also export as items headlines for which no section
      ;;         format has been found.
-     ((or (not section-fmt)
-	  (and (wholenump (plist-get info :headline-levels))
-	       (> level (plist-get info :headline-levels))))
+     ((or (not section-fmt) (org-export-low-level-p headline info))
       ;; Build the real contents of the sub-tree.
       (let ((low-level-body
 	     (concat

+ 27 - 12
contrib/lisp/org-export.el

@@ -1124,12 +1124,16 @@ Following tree properties are set:
   (setq info
 	(org-combine-plists
 	 info `(:use-select-tags ,(org-export-use-select-tags-p data info))))
-  ;; Get the rest of the tree properties, now `:use-select-tags' is
-  ;; set...
+  ;; Then get `:headline-offset' in order to be able to use
+  ;; `org-export-get-relative-level'.
+  (setq info
+	(org-combine-plists
+	 info `(:headline-offset ,(- 1 (org-export-get-min-level data info)))))
+  ;; Now, get the rest of the tree properties, now `:use-select-tags'
+  ;; is set...
   (nconc
    `(:parse-tree
      ,data
-     :headline-offset ,(- 1 (org-export-get-min-level data info))
      :point-max ,(org-export-get-point-max data info)
      :target-list
      ,(org-element-map data 'target (lambda (target local) target) info)
@@ -1186,9 +1190,8 @@ OPTIONS is a plist holding export options."
 DATA is the parse tree.  OPTIONS is the plist holding export
 options.
 
-Return an alist whose key is headline's beginning position and
-value is its associated numbering (in the shape of a list of
-numbers)."
+Return an alist whose key is an headline and value is its
+associated numbering \(in the shape of a list of numbers\)."
   (let ((numbering (make-vector org-export-max-depth 0)))
     (org-element-map
      data
@@ -1197,7 +1200,7 @@ numbers)."
        (let ((relative-level
 	      (1- (org-export-get-relative-level headline info))))
 	 (cons
-	  (org-element-get-property :begin headline)
+	  headline
 	  (loop for n across numbering
 		for idx from 0 to org-export-max-depth
 		when (< idx relative-level) collect n
@@ -2053,9 +2056,9 @@ INFO is the plist used as a communication channel."
 ;; headline, while `org-export-number-to-roman' allows to convert it
 ;; to roman numbers.
 
-;; `org-export-first-sibling-p' and `org-export-last-sibling-p' are
-;; two useful predicates when it comes to fulfill the
-;; `:headline-levels' property.
+;; `org-export-low-level-p', `org-export-first-sibling-p' and
+;; `org-export-last-sibling-p' are three useful predicates when it
+;; comes to fulfill the `:headline-levels' property.
 
 (defun org-export-get-relative-level (headline info)
   "Return HEADLINE relative level within current parsed tree.
@@ -2063,11 +2066,23 @@ INFO is a plist holding contextual information."
   (+ (org-element-get-property :level headline)
      (or (plist-get info :headline-offset) 0)))
 
+(defun org-export-low-level-p (headline info)
+  "Non-nil when HEADLINE is considered as low level.
+
+A low level headlines has a relative level greater than
+`:headline-levels' property value.
+
+Return value is the difference between HEADLINE relative level
+and the last level being considered as high enough, or nil."
+  (let ((limit (plist-get info :headline-levels)))
+    (when (wholenump limit)
+      (let ((level (org-export-get-relative-level headline info)))
+        (and (> level limit) (- level limit))))))
+
 (defun org-export-get-headline-number (headline info)
   "Return HEADLINE numbering as a list of numbers.
 INFO is a plist holding contextual information."
-  (cdr (assq (org-element-get-property :begin headline)
-	     (plist-get info :headline-numbering))))
+  (cdr (assoc headline (plist-get info :headline-numbering))))
 
 (defun org-export-number-to-roman (n)
   "Convert integer N into a roman numeral."