org-element: Remove :level attribute from plain-list elements

* contrib/lisp/org-element.el (org-element-plain-list-parser):
  Remove :level attribute from plain-list elements since it isn't
  directly related to the plain-list and can be computed during export
  process.
* contrib/lisp/org-e-latex.el (org-e-latex-item): Compute list level.
* contrib/lisp/org-e-html.el (org-e-html-item): Remove unneeded
  reference to :level attribute.
* contrib/lisp/org-e-odt.el (org-e-odt-item): Remove unneeded
  reference to :level attribute.
This commit is contained in:
Nicolas Goaziou 2012-05-04 19:44:55 +02:00
parent d83ab52626
commit 2a6b7c87f4
4 changed files with 14 additions and 28 deletions

View File

@ -2219,11 +2219,8 @@ contextual information."
"Transcode an ITEM element from Org to HTML.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
;; Grab `:level' from plain-list properties, which is always the
;; first element above current item.
(let* ((plain-list (org-export-get-parent item info))
(type (org-element-property :type plain-list))
(level (org-element-property :level plain-list))
(counter (org-element-property :counter item))
(checkbox (org-element-property :checkbox item))
(tag (let ((tag (org-element-property :tag item)))

View File

@ -1347,15 +1347,17 @@ contextual information."
"Transcode an ITEM element from Org to LaTeX.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
;; Grab `:level' from plain-list properties, which is always the
;; first element above current item.
(let* ((level (org-element-property :level (org-export-get-parent item info)))
(counter (let ((count (org-element-property :counter item)))
(and count
(< level 4)
(format "\\setcounter{enum%s}{%s}\n"
(nth level '("i" "ii" "iii" "iv"))
(1- count)))))
(let* ((counter
(let ((count (org-element-property :counter item))
(level
(loop for parent in (org-export-get-genealogy item info)
count (eq (org-element-type parent) 'plain-list)
until (eq (org-element-type parent) 'headline))))
(and count
(< level 5)
(format "\\setcounter{enum%s}{%s}\n"
(nth (1- level) '("i" "ii" "iii" "iv"))
(1- count)))))
(checkbox (let ((checkbox (org-element-property :checkbox item)))
(cond ((eq checkbox 'on) "$\\boxtimes$ ")
((eq checkbox 'off) "$\\Box$ ")

View File

@ -3283,11 +3283,8 @@ contextual information."
"Transcode an ITEM element from Org to HTML.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
;; Grab `:level' from plain-list properties, which is always the
;; first element above current item.
(let* ((plain-list (org-export-get-parent item info))
(type (org-element-property :type plain-list))
(level (org-element-property :level plain-list))
(counter (org-element-property :counter item))
(checkbox (org-element-property :checkbox item))
(tag (let ((tag (org-element-property :tag item)))

View File

@ -708,8 +708,7 @@ the plain list being parsed.
Return a list whose CAR is `plain-list' and CDR is a plist
containing `:type', `:begin', `:end', `:contents-begin' and
`:contents-end', `:level', `:structure' and `:post-blank'
keywords.
`:contents-end', `:structure' and `:post-blank' keywords.
Assume point is at the beginning of the list."
(save-excursion
@ -723,17 +722,9 @@ Assume point is at the beginning of the list."
(contents-end
(goto-char (org-list-get-list-end (point) struct prevs)))
(end (save-excursion (org-skip-whitespace)
(if (eobp) (point) (point-at-bol))))
(level 0))
;; Get list level.
(let ((item contents-begin))
(while (setq item
(org-list-get-parent
(org-list-get-list-begin item struct prevs)
struct parents))
(incf level)))
(if (eobp) (point) (point-at-bol)))))
;; Blank lines below list belong to the top-level list only.
(when (> level 0)
(unless (= (org-list-get-top-point struct) contents-begin)
(setq end (min (org-list-get-bottom-point struct)
(progn (org-skip-whitespace)
(if (eobp) (point) (point-at-bol))))))
@ -744,7 +735,6 @@ Assume point is at the beginning of the list."
:end ,end
:contents-begin ,contents-begin
:contents-end ,contents-end
:level ,level
:structure ,struct
:post-blank ,(count-lines contents-end end)
,@(cadr keywords))))))