[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/toc-org d23140d604 056/128: Merge pull request #21 from sn
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/toc-org d23140d604 056/128: Merge pull request #21 from snosov1/fix-properties-handling |
Date: |
Sun, 2 Jan 2022 09:59:09 -0500 (EST) |
branch: elpa/toc-org
commit d23140d6049aade0a0c6c297b974f805622a99ae
Merge: 114dcc9813 ac2c33dcf8
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #21 from snosov1/fix-properties-handling
fix properties handling (fixes #20)
---
toc-org.el | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/toc-org.el b/toc-org.el
index 6ea2a78dd3..389cb4fc05 100644
--- a/toc-org.el
+++ b/toc-org.el
@@ -53,7 +53,7 @@ files on GitHub)"
:group 'org)
;; just in case, simple regexp "^*.*:toc:\\($\\|[^ ]*:$\\)"
-(defconst toc-org-toc-org-regexp
"^*.*:toc\\([@_][0-9]\\|\\([@_][0-9][@_][a-zA-Z]+\\)\\)?:\\($\\|[^ ]*:$\\)"
+(defconst toc-org-toc-org-regexp
"^*.*:toc\\([@_][0-9]\\|\\([@_][0-9][@_][a-zA-Z]+\\)\\)?:\\($\\|[^ ]*?:$\\)"
"Regexp to find the heading with the :toc: tag")
(defconst toc-org-tags-regexp "\s*:[[:word:]:@]*:\s*$"
"Regexp to find tags on the line")
@@ -66,6 +66,11 @@ files on GitHub)"
(defconst toc-org-special-chars-regexp "[^[:alnum:]_-]"
"Regexp with the special characters (which are omitted in hrefs
by GitHub)")
+(defconst toc-org-drawer-regexp "^[ ]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ ]*$"
+ "Regexp to match org drawers. Note: generally, it should be
+equal to `org-drawer-regexp'. However, some older versions of
+org (notably, 8.2.10) restrict the values that can be placed
+between the colons. So, the value here is set explicitly.")
(defcustom toc-org-max-depth 2
"Maximum depth of the headings to use in the table of
@@ -356,6 +361,14 @@ following tag formats:
(unless dry-run
(newline (forward-line 1))
+ ;; skip drawers
+ (let ((end
+ (save-excursion ;; limit to next heading
+ (search-forward-regexp "^\\*" (point-max) t))))
+ (while (re-search-forward toc-org-drawer-regexp end t)
+ (skip-chars-forward "[:space:]")))
+ (beginning-of-line)
+
;; insert newline if TOC is currently empty
(when (looking-at "^\\*")
(open-line 1))
@@ -398,7 +411,6 @@ following tag formats:
(with-temp-buffer
(org-mode)
(insert content)
- (toc-org-raw-toc)
(toc-org-insert-toc)
(should (equal
(buffer-substring-no-properties
@@ -425,7 +437,12 @@ following tag formats:
(test-toc-org-insert-toc-gold-test
(concat beg ":TOC_3_org:")
- "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an
up-to-date table of contents in the\norg files without exporting (useful
primarily for readme files on\nGitHub).\n\nIt is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works
for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n*
Table of Contents
:TOC_3_org:\n - [[About][About]]\n - [[Hello][Hello]]\n - [...]
+ "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an
up-to-date table of contents in the\norg files without exporting (useful
primarily for readme files on\nGitHub).\n\nIt is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works
for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n*
Table of Contents
:TOC_3_org:\n - [[About][About]]\n - [[Hello][Hello]]\n - [...]
+
+ (test-toc-org-insert-toc-gold-test
+ (concat beg ":TOC:\n:PROPERTIES:\n:VISIBILITY: content\n:END:\n")
+ "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an
up-to-date table of contents in the\norg files without exporting (useful
primarily for readme files on\nGitHub).\n\nIt is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works
for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n*
Table of Contents
:TOC:\n:PROPERTIES:\n:VISIBILITY: content\n:END:\n - [[#abou [...]
+ ))
;; Local Variables:
;; compile-command: "emacs -batch -l ert -l *.el -f
ert-run-tests-batch-and-exit && emacs -batch -f batch-byte-compile *.el 2>&1 |
sed -n '/Warning\|Error/p' | xargs -r ls"
- [nongnu] elpa/toc-org 158934fefd 064/128: Merge pull request #31 from azizyemloul/delete-heading-trailing-spaces, (continued)
- [nongnu] elpa/toc-org 158934fefd 064/128: Merge pull request #31 from azizyemloul/delete-heading-trailing-spaces, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org a0e8ca05e8 066/128: Merge pull request #33 from iqbalansari/master, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 39fbbda8df 081/128: handle custom keywords specified in the files, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 8dbb3df422 125/128: Fix byte-compiler warning in Emacs 28, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org a3d953a5fa 076/128: Update and clarify primary docstring to explain :noexport:, etc., ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 5a2d7e58dd 028/128: add org-toc-2 alias, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org da99c5d801 023/128: require ert, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 63a0144afa 031/128: fix documentation, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org cfb309e8ab 035/128: fix typo, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 1a213baa8a 048/128: don't alter the type and path if we don't recognize it as a TOC entry, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d23140d604 056/128: Merge pull request #21 from snosov1/fix-properties-handling,
ELPA Syncer <=
- [nongnu] elpa/toc-org 17c6cf1d1a 060/128: add tests, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 01cb78ead6 063/128: Use `delete-region` instead of kill-line while creating the TOC, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d3d3503b34 062/128: Delete trailing whitespaces from links, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 4d076d1e9d 118/128: Respect the file-local value of org-list-indent-offset., ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org f3218fdaf1 123/128: Add license and copyright header to toc-org-test.el, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 501f36db68 021/128: Merge pull request #5 from ardumont/wrap-tests-definition, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 658c03111b 017/128: add some more tests and fix wording, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d3677cd8c8 022/128: make compile-command run the tests, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 0dee7197c8 026/128: fix byte-compilation check, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 242eecba19 034/128: add a note about previous name, ELPA Syncer, 2022/01/02