[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/toc-org d52f95fae8 105/128: Handle trailing #'s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/toc-org d52f95fae8 105/128: Handle trailing #'s |
Date: |
Sun, 2 Jan 2022 09:59:14 -0500 (EST) |
branch: elpa/toc-org
commit d52f95fae8c54bdcbd63ba0d394074156d8e4a70
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: Sergei Nosov <sergei.nosov@gmail.com>
Handle trailing #'s
---
README.org | 7 +++----
toc-org-test.el | 4 ++--
toc-org.el | 13 ++++++++++---
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/README.org b/README.org
index a175ae989c..3044c5460b 100644
--- a/README.org
+++ b/README.org
@@ -2,11 +2,11 @@
* About
-toc-org helps you to have an up-to-date table of contents in org files without
+=toc-org= helps you to have an up-to-date table of contents in org files
without
exporting (useful primarily for readme files on GitHub).
It is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works
for org files. Since
-recently, it, actually, works in [[Markdown support][markdown]], too!
+recently, =toc-org=, actually, works in [[Markdown support][markdown]], too!
*NOTE:* Previous name of the package is =org-toc=. It was changed because of a
name conflict with one of the org contrib modules.
@@ -126,8 +126,7 @@ Now =C-c C-q T RET= and you are done putting the =:TOC:=
entry.
You can also enable the mode in Markdown files and get pretty much the same
functionality. The package will
-1. Look for '#'s instead of '*'s as heading markers (so, markdown syntax with
- trailing pounds, like, =## Heading 2 ##= is not supported).
+1. Look for '#'s instead of '*'s as heading markers.
2. Expect the =:TOC:= tag to appear as comment, like, =<-- :TOC: -->=
3. Format the links and the quote block according to Markdown syntax
diff --git a/toc-org-test.el b/toc-org-test.el
index fe794115a7..d927befeea 100644
--- a/toc-org-test.el
+++ b/toc-org-test.el
@@ -260,8 +260,8 @@
(declare-function test-toc-org-insert-toc-gold-test-markdown "toc-org")
(declare-function markdown-mode "toc-org")
- (let ((beg "# 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 "))
+ (let ((beg "# 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 "))
(test-toc-org-insert-toc-gold-test-markdown
(concat beg "<-- :TOC: -->")
- "# 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- [About](#about)\n- [Hello](#hello)\n - [Go [...]
+ "# 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- [About](#about)\n- [Hello](#hello)\n - [...]
))
diff --git a/toc-org.el b/toc-org.el
index aae301d6d9..f519b20f8b 100644
--- a/toc-org.el
+++ b/toc-org.el
@@ -24,8 +24,8 @@
;;; Commentary:
-;; toc-org helps you to have an up-to-date table of contents in org files
-;; without exporting (useful primarily for readme files on GitHub).
+;; toc-org helps you to have an up-to-date table of contents in org or markdown
+;; files without exporting (useful primarily for readme files on GitHub).
;; NOTE: Previous name of the package is org-toc. It was changed because of a
;; name conflict with one of the org contrib modules.
@@ -33,7 +33,11 @@
;; After installation put into your .emacs file something like
;; (if (require 'toc-org nil t)
-;; (add-hook 'org-mode-hook 'toc-org-enable)
+;; (add-hook 'org-mode-hook 'toc-org-mode)
+
+;; ;; enable in markdown, too
+;; (add-hook 'markdown-mode-hook 'toc-org-mode)
+;; (define-key markdown-mode-map (kbd "\C-c\C-o")
'toc-org-markdown-follow-thing-at-point)
;; (warn "toc-org not found"))
;; And every time you'll be saving an org file, the first headline with a :TOC:
@@ -138,6 +142,9 @@ auxiliary text."
(make-string (1- (length (match-string 0))) ?*)
" ") nil nil))
(goto-char (point-min))
+ (while (re-search-forward "\s+#+$" nil t)
+ (replace-match "" nil nil))
+ (goto-char (point-min))
(while (re-search-forward "\\(^*.*\\)<-- \\(:toc[^ ]*:\\)
-->\\($\\)" nil t)
(replace-match (concat (match-string 1) (match-string 2)
(match-string 3)) nil nil)))))
- [nongnu] elpa/toc-org 501f36db68 021/128: Merge pull request #5 from ardumont/wrap-tests-definition, (continued)
- [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
- [nongnu] elpa/toc-org 90894242a6 046/128: treat org-list-indent-offset properly, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 4c0b28da59 037/128: add more tags for easier search, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org e38e81af3f 088/128: Merge pull request #57 from JAremko/master, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org cda8f73640 073/128: Merge pull request #37 from snosov1/handle-comment, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org ee70dd23e1 104/128: resolve missing functions warnings, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d52f95fae8 105/128: Handle trailing #'s,
ELPA Syncer <=
- [nongnu] elpa/toc-org 5ce7c24920 096/128: handle paranthesis in #+TODO line (fixes #65), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org b1bab4c078 072/128: handle nil that is sometimes returned by (current-word), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 9efeec690c 111/128: Remove the "backup" variable, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org ff8d49c2c7 113/128: Merge pull request #69 from htsr/comment-stripping, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 95a558b362 099/128: add tests for markdown-style syntax, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org e33e4cc00a 084/128: Merge pull request #50 from snosov1/handle-custom-keywords, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 7291a3b08d 100/128: Enable link following in markdown mode, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org f455bd4c88 103/128: Call batch compile before running the tests, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 8321d3c76b 120/128: Revert "Respect the file-local value of org-list-indent-offset.", ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 6eca67f9a8 127/128: Merge pull request #83 from skangas/silence-byte-compiler, ELPA Syncer, 2022/01/02