summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-07-24 16:04:35 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-07-24 22:52:29 +0200
commitdbea7e658fde62fe7fadab73d2cf6d7951413e5e (patch)
treec9b286a34800cfec3f0c031952cc65959b6f36e0
parente0f59dfb0559152832d15d7c60d07d4af82938d7 (diff)
downloadorg-mode-dbea7e658fde62fe7fadab73d2cf6d7951413e5e.tar.gz
org-export: Rename some internal functions
* contrib/lisp/org-export.el (org-export-get-environment, org-export-collect-tree-properties, org-export-data, org-export-expand-include-keyword): Use new names. (org-export--parse-option-keyword): Renamed from `org-export-parse-option-keyword'. (org-export--get-subtree-options): Renamed from `org-export-get-subtree-options'. (org-export--get-inbuffer-options): Renamed from `org-export-get-inbuffer-options'. (org-export--get-buffer-attributes): Renamed from `org-export-get-buffer-attributes'. (org-export--get-global-options): Renamed from `org-export-get-global-options'. (org-export--allow-BIND-local): Renamed from `org-export-allow-BIND-local'. (org-export--confirm-letbind): Renamed from `org-export-confirm-letbind'. (org-export--install-letbind-maybe): Renamed from `org-export-install-letbind-maybe'. (org-export--get-min-level): Renamed from `org-export-get-min-level'. (org-export--collect-headline-numbering): Renamed from `org-export-collect-headline-numbering'. (org-export--populate-ignore-list): Renamed from `org-export-populate-ignore-list'. (org-export--interpret-p): Renamed from `org-export--interpret-p'. (org-export--prepare-file-contents): Renamed from `org-export-prepare-file-contents'. * contrib/lisp/org-e-publish.el (org-e-publish-find-date): Use new names. * testing/lisp/test-org-export.el: Update tests.
-rw-r--r--contrib/lisp/org-e-publish.el2
-rw-r--r--contrib/lisp/org-export.el90
-rw-r--r--testing/lisp/test-org-export.el18
3 files changed, 56 insertions, 54 deletions
diff --git a/contrib/lisp/org-e-publish.el b/contrib/lisp/org-e-publish.el
index b17a1e0..28ee496 100644
--- a/contrib/lisp/org-e-publish.el
+++ b/contrib/lisp/org-e-publish.el
@@ -868,7 +868,7 @@ It returns time in `current-time' format."
(date (plist-get
(with-current-buffer file-buf
(org-mode)
- (org-export-get-inbuffer-options))
+ (org-export--get-inbuffer-options))
:date)))
(unless visiting (kill-buffer file-buf))
(if date (org-time-string-to-time date)
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el
index 9325621..1526b9d 100644
--- a/contrib/lisp/org-export.el
+++ b/contrib/lisp/org-export.el
@@ -181,7 +181,7 @@ Properties redefined there have precedence over these.")
"List of in-buffer keywords that require special treatment.
These keywords are not directly associated to a property. The
way they are handled must be hard-coded into
-`org-export-get-inbuffer-options' function.")
+`org-export--get-inbuffer-options' function.")
(defconst org-export-filters-alist
'((:filter-bold . org-export-filter-bold-functions)
@@ -1212,13 +1212,13 @@ structure of the values."
;; the different sources.
;;
;; The internal functions doing the retrieval are:
-;; `org-export-get-global-options',
-;; `org-export-get-buffer-attributes',
-;; `org-export-parse-option-keyword',
-;; `org-export-get-subtree-options' and
-;; `org-export-get-inbuffer-options'
+;; `org-export--get-global-options',
+;; `org-export--get-buffer-attributes',
+;; `org-export--parse-option-keyword',
+;; `org-export--get-subtree-options' and
+;; `org-export--get-inbuffer-options'
;;
-;; Also, `org-export-confirm-letbind' and `org-export-install-letbind'
+;; Also, `org-export--confirm-letbind' and `org-export--install-letbind'
;; take care of the part relative to "#+BIND:" keywords.
(defun org-export-get-environment (&optional backend subtreep ext-plist)
@@ -1234,21 +1234,21 @@ Third optional argument EXT-PLIST is a property list with
external parameters overriding Org default settings, but still
inferior to file-local settings."
;; First install #+BIND variables.
- (org-export-install-letbind-maybe)
+ (org-export--install-letbind-maybe)
;; Get and prioritize export options...
(org-combine-plists
;; ... from global variables...
- (org-export-get-global-options backend)
+ (org-export--get-global-options backend)
;; ... from buffer's attributes...
- (org-export-get-buffer-attributes)
+ (org-export--get-buffer-attributes)
;; ... from an external property list...
ext-plist
;; ... from in-buffer settings...
- (org-export-get-inbuffer-options
+ (org-export--get-inbuffer-options
backend
(and buffer-file-name (org-remove-double-quotes buffer-file-name)))
;; ... and from subtree, when appropriate.
- (and subtreep (org-export-get-subtree-options backend))
+ (and subtreep (org-export--get-subtree-options backend))
;; Eventually install back-end symbol and its translation table.
`(:back-end
,backend
@@ -1256,7 +1256,7 @@ inferior to file-local settings."
,(let ((trans-alist (intern (format "org-%s-translate-alist" backend))))
(when (boundp trans-alist) (symbol-value trans-alist))))))
-(defun org-export-parse-option-keyword (options &optional backend)
+(defun org-export--parse-option-keyword (options &optional backend)
"Parse an OPTIONS line and return values as a plist.
Optional argument BACKEND is a symbol specifying which back-end
specific items to read, if any."
@@ -1285,7 +1285,7 @@ specific items to read, if any."
alist)
plist))
-(defun org-export-get-subtree-options (&optional backend)
+(defun org-export--get-subtree-options (&optional backend)
"Get export options in subtree at point.
Optional argument BACKEND is a symbol specifying back-end used
for export. Return options as a plist."
@@ -1310,7 +1310,7 @@ for export. Return options as a plist."
;; EXPORT_OPTIONS are parsed in a non-standard way.
(when (setq prop (org-entry-get (point) "EXPORT_OPTIONS"))
(setq plist
- (nconc plist (org-export-parse-option-keyword prop backend))))
+ (nconc plist (org-export--parse-option-keyword prop backend))))
;; Handle other keywords.
(let ((seen '("TITLE")))
(mapc
@@ -1340,7 +1340,7 @@ for export. Return options as a plist."
;; Return value.
plist)))
-(defun org-export-get-inbuffer-options (&optional backend files)
+(defun org-export--get-inbuffer-options (&optional backend files)
"Return current buffer export options, as a plist.
Optional argument BACKEND, when non-nil, is a symbol specifying
@@ -1372,10 +1372,10 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
(with-temp-buffer
(insert (org-file-contents file 'noerror))
(org-mode)
- (org-export-get-inbuffer-options
+ (org-export--get-inbuffer-options
backend (cons file files))))))
((string= key "OPTIONS")
- (org-export-parse-option-keyword val backend))
+ (org-export--parse-option-keyword val backend))
((string= key "MACRO")
(when (string-match
"^\\([-a-zA-Z0-9_]+\\)\\(?:[ \t]+\\(.*?\\)[ \t]*$\\)?"
@@ -1468,7 +1468,7 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
;; 3. Return final value.
plist)))
-(defun org-export-get-buffer-attributes ()
+(defun org-export--get-buffer-attributes ()
"Return properties related to buffer attributes, as a plist."
(let ((visited-file (buffer-file-name (buffer-base-buffer))))
(list
@@ -1527,7 +1527,7 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
:macro-time "(eval (format-time-string \"$1\"))"
:macro-property "(eval (org-entry-get nil \"$1\" 'selective))")))
-(defun org-export-get-global-options (&optional backend)
+(defun org-export--get-global-options (&optional backend)
"Return global export options as a plist.
Optional argument BACKEND, if non-nil, is a symbol specifying
@@ -1559,19 +1559,20 @@ process."
;; Return value.
plist))
-(defvar org-export-allow-BIND-local nil)
-(defun org-export-confirm-letbind ()
+(defvar org-export--allow-BIND-local nil)
+(defun org-export--confirm-letbind ()
"Can we use #+BIND values during export?
By default this will ask for confirmation by the user, to divert
possible security risks."
(cond
((not org-export-allow-BIND) nil)
((eq org-export-allow-BIND t) t)
- ((local-variable-p 'org-export-allow-BIND-local) org-export-allow-BIND-local)
- (t (org-set-local 'org-export-allow-BIND-local
+ ((local-variable-p 'org-export--allow-BIND-local)
+ org-export--allow-BIND-local)
+ (t (org-set-local 'org-export--allow-BIND-local
(yes-or-no-p "Allow BIND values in this buffer? ")))))
-(defun org-export-install-letbind-maybe ()
+(defun org-export--install-letbind-maybe ()
"Install the values from #+BIND lines as local variables.
Variables must be installed before in-buffer options are
retrieved."
@@ -1594,11 +1595,11 @@ retrieved."
;;
;; Dedicated functions focus on computing the value of specific tree
;; properties during initialization. Thus,
-;; `org-export-populate-ignore-list' lists elements and objects that
-;; should be skipped during export, `org-export-get-min-level' gets
+;; `org-export--populate-ignore-list' lists elements and objects that
+;; should be skipped during export, `org-export--get-min-level' gets
;; the minimal exportable level, used as a basis to compute relative
;; level for headlines. Eventually
-;; `org-export-collect-headline-numbering' builds an alist between
+;; `org-export--collect-headline-numbering' builds an alist between
;; headlines and their numbering.
(defun org-export-collect-tree-properties (data info)
@@ -1634,13 +1635,14 @@ Return updated plist."
(setq info
(plist-put info
:ignore-list
- (append (org-export-populate-ignore-list data info)
+ (append (org-export--populate-ignore-list data info)
(plist-get info :ignore-list))))
;; Compute `:headline-offset' in order to be able to use
;; `org-export-get-relative-level'.
(setq info
(plist-put info
- :headline-offset (- 1 (org-export-get-min-level data info))))
+ :headline-offset
+ (- 1 (org-export--get-min-level data info))))
;; Update footnotes definitions list with definitions in parse tree.
;; This is required since buffer expansion might have modified
;; boundaries of footnote definitions contained in the parse tree.
@@ -1664,10 +1666,10 @@ Return updated plist."
(when (or (eq (org-element-type blob) 'target)
(string= (org-element-property :key blob) "TARGET"))
blob)) info)
- :headline-numbering ,(org-export-collect-headline-numbering data info))
+ :headline-numbering ,(org-export--collect-headline-numbering data info))
info))
-(defun org-export-get-min-level (data options)
+(defun org-export--get-min-level (data options)
"Return minimum exportable headline's level in DATA.
DATA is parsed tree as returned by `org-element-parse-buffer'.
OPTIONS is a plist holding export options."
@@ -1685,7 +1687,7 @@ OPTIONS is a plist holding export options."
;; minimum level to 1 nonetheless.
(if (= min-level 10000) 1 min-level))))
-(defun org-export-collect-headline-numbering (data options)
+(defun org-export--collect-headline-numbering (data options)
"Return numbering of all exportable headlines in a parse tree.
DATA is the parse tree. OPTIONS is the plist holding export
@@ -1709,7 +1711,7 @@ associated numbering \(in the shape of a list of numbers\)."
when (> idx relative-level) do (aset numbering idx 0)))))
options)))
-(defun org-export-populate-ignore-list (data options)
+(defun org-export--populate-ignore-list (data options)
"Return list of elements and objects to ignore during export.
DATA is the parse tree to traverse. OPTIONS is the plist holding
export options."
@@ -1846,7 +1848,7 @@ tag."
;; Internally, three functions handle the filtering of objects and
;; elements during the export. In particular,
;; `org-export-ignore-element' marks an element or object so future
-;; parse tree traversals skip it, `org-export-interpret-p' tells which
+;; parse tree traversals skip it, `org-export--interpret-p' tells which
;; elements or objects should be seen as real Org syntax and
;; `org-export-expand' transforms the others back into their original
;; shape
@@ -1884,7 +1886,7 @@ Return transcoded string."
info))
;; Uninterpreted element/object: change it back to Org
;; syntax and export again resulting raw string.
- ((not (org-export-interpret-p data info))
+ ((not (org-export--interpret-p data info))
(org-export-data
(org-export-expand
data
@@ -1955,7 +1957,7 @@ Return transcoded string."
;; Eventually return string.
results)))))
-(defun org-export-interpret-p (blob info)
+(defun org-export--interpret-p (blob info)
"Non-nil if element or object BLOB should be interpreted as Org syntax.
Check is done according to export options INFO, stored as
a plist."
@@ -2458,7 +2460,7 @@ Return the updated communication channel."
;;
;; File inclusion is taken care of by
;; `org-export-expand-include-keyword' and
-;; `org-export-prepare-file-contents'. Structure wise, including
+;; `org-export--prepare-file-contents'. Structure wise, including
;; a whole Org file in a buffer often makes little sense. For
;; example, if the file contains an headline and the include keyword
;; was within an item, the item should contain the headline. That's
@@ -2737,7 +2739,7 @@ paths."
;; Protect sensitive contents with commas.
(replace-regexp-in-string
"\\(^\\)\\([*]\\|[ \t]*#\\+\\)" ","
- (org-export-prepare-file-contents file lines)
+ (org-export--prepare-file-contents file lines)
nil nil 1)))
(format "%s#+BEGIN_EXAMPLE\n%s%s#+END_EXAMPLE\n"
ind-str contents ind-str))))
@@ -2749,8 +2751,8 @@ paths."
(replace-regexp-in-string
(if (string= env "org") "\\(^\\)\\(.\\)"
"\\(^\\)\\([*]\\|[ \t]*#\\+\\)") ","
- (org-export-prepare-file-contents file lines)
- nil nil 1)))
+ (org-export--prepare-file-contents file lines)
+ nil nil 1)))
(format "%s#+BEGIN_SRC %s\n%s%s#+END_SRC\n"
ind-str env contents ind-str))))
(t
@@ -2758,13 +2760,13 @@ paths."
(with-temp-buffer
(org-mode)
(insert
- (org-export-prepare-file-contents file lines ind minlevel))
+ (org-export--prepare-file-contents file lines ind minlevel))
(org-export-expand-include-keyword
(cons (list file lines) included)
(file-name-directory file))
(buffer-string))))))))))))
-(defun org-export-prepare-file-contents (file &optional lines ind minlevel)
+(defun org-export--prepare-file-contents (file &optional lines ind minlevel)
"Prepare the contents of FILE for inclusion and return them as a string.
When optional argument LINES is a string specifying a range of
@@ -2833,7 +2835,7 @@ file should have."
;; sections.
(org-map-entries
(lambda () (if (< offset 0) (delete-char (abs offset))
- (insert (make-string offset ?*))))))))))
+ (insert (make-string offset ?*))))))))))
(buffer-string)))
diff --git a/testing/lisp/test-org-export.el b/testing/lisp/test-org-export.el
index ca3861f..bc4adcd 100644
--- a/testing/lisp/test-org-export.el
+++ b/testing/lisp/test-org-export.el
@@ -63,7 +63,7 @@ already filled in `info'."
"Test reading all standard #+OPTIONS: items."
(should
(equal
- (org-export-parse-option-keyword
+ (org-export--parse-option-keyword
"H:1 num:t \\n:t timestamp:t arch:t author:t creator:t d:t email:t
*:t e:t ::t f:t pri:t -:t ^:t toc:t |:t tags:t tasks:t <:t todo:t")
'(:headline-levels
@@ -76,7 +76,7 @@ already filled in `info'."
;; Test some special values.
(should
(equal
- (org-export-parse-option-keyword
+ (org-export--parse-option-keyword
"arch:headline creator:comment d:(\"TEST\")
^:{} toc:1 tags:not-in-toc tasks:todo num:2 <:active")
'( :section-numbers
@@ -101,7 +101,7 @@ already filled in `info'."
#+SELECT_TAGS: export
#+TITLE: Some title
#+TITLE: with spaces"
- (org-export-get-inbuffer-options))
+ (org-export--get-inbuffer-options))
'(:author
("Me, Myself and I") :creator "Idem" :date ("Today")
:description "Testing\nwith two lines" :email "some@email.org"
@@ -923,28 +923,28 @@ Another text. (ref:text)
"Try defining various Org macro using in-buffer #+MACRO: keyword."
;; Parsed macro.
(should (equal (org-test-with-temp-text "#+MACRO: one 1"
- (org-export-get-inbuffer-options))
+ (org-export--get-inbuffer-options))
'(:macro-one ("1"))))
;; Evaled macro.
(should (equal (org-test-with-temp-text "#+MACRO: two (eval (+ 1 1))"
- (org-export-get-inbuffer-options))
+ (org-export--get-inbuffer-options))
'(:macro-two ("(eval (+ 1 1))"))))
;; Incomplete macro.
(should-not (org-test-with-temp-text "#+MACRO: three"
- (org-export-get-inbuffer-options)))
+ (org-export--get-inbuffer-options)))
;; Macro with newline character.
(should (equal (org-test-with-temp-text "#+MACRO: four a\\nb"
- (org-export-get-inbuffer-options))
+ (org-export--get-inbuffer-options))
'(:macro-four ("a\nb"))))
;; Macro with protected newline character.
(should (equal (org-test-with-temp-text "#+MACRO: five a\\\\nb"
- (org-export-get-inbuffer-options))
+ (org-export--get-inbuffer-options))
'(:macro-five ("a\\nb"))))
;; Recursive macro.
(org-test-with-temp-text "#+MACRO: six 6\n#+MACRO: seven 1 + {{{six}}}"
(should
(equal
- (org-export-get-inbuffer-options)
+ (org-export--get-inbuffer-options)
'(:macro-six
("6")
:macro-seven