瀏覽代碼

org-element: Remove quote sections

* lisp/org-element.el (org-element-quote-section-parser,
  org-element-quote-section-interpreter): Remove functions.
  (org-element--current-element, org-element--parse-elements): Do not
  handle quote sections at all.
* testing/lisp/test-org-element.el (test-org-element/quote-section-parser):
  Remove test.
Nicolas Goaziou 11 年之前
父節點
當前提交
8a265e2915
共有 2 個文件被更改,包括 15 次插入66 次删除
  1. 15 52
      lisp/org-element.el
  2. 0 14
      testing/lisp/test-org-element.el

+ 15 - 52
lisp/org-element.el

@@ -31,13 +31,12 @@
 ;;
 ;; An element always starts and ends at the beginning of a line.  With
 ;; a few exceptions (`clock', `headline', `inlinetask', `item',
-;; `planning', `node-property', `quote-section' `section' and
-;; `table-row' types), it can also accept a fixed set of keywords as
-;; attributes.  Those are called "affiliated keywords" to distinguish
-;; them from other keywords, which are full-fledged elements.  Almost
-;; all affiliated keywords are referenced in
-;; `org-element-affiliated-keywords'; the others are export attributes
-;; and start with "ATTR_" prefix.
+;; `planning', `node-property', `section' and `table-row' types), it
+;; can also accept a fixed set of keywords as attributes.  Those are
+;; called "affiliated keywords" to distinguish them from other
+;; keywords, which are full-fledged elements.  Almost all affiliated
+;; keywords are referenced in `org-element-affiliated-keywords'; the
+;; others are export attributes and start with "ATTR_" prefix.
 ;;
 ;; Element containing other elements (and only elements) are called
 ;; greater elements.  Concerned types are: `center-block', `drawer',
@@ -48,10 +47,9 @@
 ;; Other element types are: `babel-call', `clock', `comment',
 ;; `comment-block', `diary-sexp', `example-block', `export-block',
 ;; `fixed-width', `horizontal-rule', `keyword', `latex-environment',
-;; `node-property', `paragraph', `planning', `quote-section',
-;; `src-block', `table', `table-row' and `verse-block'.  Among them,
-;; `paragraph' and `verse-block' types can contain Org objects and
-;; plain text.
+;; `node-property', `paragraph', `planning', `src-block', `table',
+;; `table-row' and `verse-block'.  Among them, `paragraph' and
+;; `verse-block' types can contain Org objects and plain text.
 ;;
 ;; Objects are related to document's contents.  Some of them are
 ;; recursive.  Associated types are of the following: `bold', `code',
@@ -178,7 +176,7 @@ is not sufficient to know if point is at a paragraph ending.  See
 	       dynamic-block example-block export-block fixed-width
 	       footnote-definition headline horizontal-rule inlinetask item
 	       keyword latex-environment node-property paragraph plain-list
-	       planning property-drawer quote-block quote-section section
+	       planning property-drawer quote-block section
 	       special-block src-block table table-row verse-block)
   "Complete list of element types.")
 
@@ -2295,37 +2293,6 @@ CONTENTS is nil."
    " "))
 
 
-;;;; Quote Section
-
-(defun org-element-quote-section-parser (limit)
-  "Parse a quote section.
-
-LIMIT bounds the search.
-
-Return a list whose CAR is `quote-section' and CDR is a plist
-containing `:begin', `:end', `:value' and `:post-blank' keywords.
-
-Assume point is at beginning of the section."
-  (save-excursion
-    (let* ((begin (point))
-	   (end (progn (org-with-limited-levels (outline-next-heading))
-		       (point)))
-	   (pos-before-blank (progn (skip-chars-backward " \r\t\n")
-				    (forward-line)
-				    (point)))
-	   (value (buffer-substring-no-properties begin pos-before-blank)))
-      (list 'quote-section
-	    (list :begin begin
-		  :end end
-		  :value value
-		  :post-blank (count-lines pos-before-blank end))))))
-
-(defun org-element-quote-section-interpreter (quote-section contents)
-  "Interpret QUOTE-SECTION element as Org syntax.
-CONTENTS is nil."
-  (org-element-property :value quote-section))
-
-
 ;;;; Src Block
 
 (defun org-element-src-block-parser (limit affiliated)
@@ -3812,7 +3779,7 @@ CONTENTS is nil."
 ;; are activated for fixed element chaining (i.e. `plain-list' >
 ;; `item') or fixed conditional element chaining (i.e. `headline' >
 ;; `section').  Special modes are: `first-section', `item',
-;; `node-property', `quote-section', `section' and `table-row'.
+;; `node-property', `section' and `table-row'.
 
 (defun org-element--current-element
   (limit &optional granularity special structure)
@@ -3833,8 +3800,8 @@ nil), secondary values will not be parsed, since they only
 contain objects.
 
 Optional argument SPECIAL, when non-nil, can be either
-`first-section', `item', `node-property', `quote-section',
-`section', and `table-row'.
+`first-section', `item', `node-property', `section', and
+`table-row'.
 
 If STRUCTURE isn't provided but SPECIAL is set to `item', it will
 be computed.
@@ -3860,7 +3827,6 @@ element it has to parse."
         (org-element-headline-parser limit raw-secondary-p))
        ;; Sections (must be checked after headline).
        ((eq special 'section) (org-element-section-parser limit))
-       ((eq special 'quote-section) (org-element-quote-section-parser limit))
        ((eq special 'first-section)
 	(org-element-section-parser
 	 (or (save-excursion (org-with-limited-levels (outline-next-heading)))
@@ -4296,8 +4262,7 @@ looking into captions:
   "Parse elements between BEG and END positions.
 
 SPECIAL prioritize some elements over the others.  It can be set
-to `first-section', `quote-section', `section' `item' or
-`table-row'.
+to `first-section', `section' `item' or `table-row'.
 
 When value is `item', STRUCTURE will be used as the current list
 structure.
@@ -4347,9 +4312,7 @@ Elements are accumulated into ACC."
 	   cbeg (org-element-property :contents-end element)
 	   ;; Possibly switch to a special mode.
 	   (case type
-	     (headline
-	      (if (org-element-property :quotedp element) 'quote-section
-		'section))
+	     (headline 'section)
 	     (plain-list 'item)
 	     (property-drawer 'node-property)
 	     (table 'table-row))

+ 0 - 14
testing/lisp/test-org-element.el

@@ -1712,20 +1712,6 @@ Outside list"
      (= (org-element-property :end (org-element-at-point)) (point-max)))))
 
 
-;;;; Quote Section
-
-(ert-deftest test-org-element/quote-section-parser ()
-  "Test `quote-section' parser."
-  (should
-   (let ((org-quote-string "QUOTE"))
-     (org-test-with-temp-text "* QUOTE Headline\nBody"
-       (org-element-map (org-element-parse-buffer) 'quote-section 'identity))))
-  (should-not
-   (let ((org-quote-string "TEST"))
-     (org-test-with-temp-text "* QUOTE Headline\nBody"
-       (org-element-map (org-element-parse-buffer) 'quote-section 'identity)))))
-
-
 ;;;; Radio Target
 
 (ert-deftest test-org-element/radio-target-parser ()