branch: elpa/toc-org
commit d66a41f6b7419d94b60058c3a71098104345a435
Author: Sergei Nosov <[email protected]>
Commit: Sergei Nosov <[email protected]>
strip tags
---
org-toc.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/org-toc.el b/org-toc.el
index be25c20e27..5fc266527b 100644
--- a/org-toc.el
+++ b/org-toc.el
@@ -66,7 +66,8 @@ and their subheadings (one and two stars)."
(defun org-toc-raw-toc ()
"Return the \"raw\" table of contents of the current file,
-i.e. simply flush everything that's not a heading."
+i.e. simply flush everything that's not a heading and strip
+tags."
(let ((content (buffer-substring-no-properties
(point-min) (point-max))))
(with-temp-buffer
@@ -80,6 +81,14 @@ i.e. simply flush everything that's not a heading."
(beginning-of-line)
(delete-region (point) (progn (forward-line 1) (point)))
+ ;; strip tags
+
+ ;; TODO :export: and :noexport: tags semantic should be probably
+ ;; implemented
+ (goto-char (point-min))
+ (while (re-search-forward "\s*:[[:word:]:@]*:\s*$" nil t)
+ (replace-match "" nil nil))
+
(buffer-substring-no-properties
(point-min) (point-max)))))