emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/toc-org d66a41f6b7 010/128: strip tags


From: ELPA Syncer
Subject: [nongnu] elpa/toc-org d66a41f6b7 010/128: strip tags
Date: Sun, 2 Jan 2022 09:59:05 -0500 (EST)

branch: elpa/toc-org
commit d66a41f6b7419d94b60058c3a71098104345a435
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: Sergei Nosov <sergei.nosov@gmail.com>

    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)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]