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

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

[nongnu] elpa/toc-org 421956e9cc 078/128: remove opening space in each t


From: ELPA Syncer
Subject: [nongnu] elpa/toc-org 421956e9cc 078/128: remove opening space in each toc item
Date: Sun, 2 Jan 2022 09:59:11 -0500 (EST)

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

    remove opening space in each toc item
---
 README.org      | 32 +++++++++++++++++---------------
 toc-org-test.el | 22 +++++++++++-----------
 toc-org.el      |  2 +-
 3 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/README.org b/README.org
index 470cd6df3a..8897bc68d7 100644
--- a/README.org
+++ b/README.org
@@ -11,16 +11,16 @@ It is similar to the 
[[https://github.com/ardumont/markdown-toc][markdown-toc]]
 name conflict with one of the org contrib modules.
 
 * Table of Contents                                                     :TOC:
- - [[#about][About]]
- - [[#installation][Installation]]
-   - [[#via-packageel][via package.el]]
-   - [[#manual][Manual]]
- - [[#use][Use]]
-   - [[#follow-links][Follow links]]
-   - [[#exclude-headings][Exclude headings]]
-   - [[#shortcut-for-toc-tag][Shortcut for TOC tag]]
- - [[#different-href-styles][Different href styles]]
- - [[#example][Example]]
+- [[#about][About]]
+- [[#installation][Installation]]
+  - [[#via-packageel][via package.el]]
+  - [[#manual][Manual]]
+- [[#use][Use]]
+  - [[#follow-links][Follow links]]
+  - [[#exclude-headings][Exclude headings]]
+  - [[#shortcut-for-toc-tag][Shortcut for TOC tag]]
+- [[#different-href-styles][Different href styles]]
+- [[#example][Example]]
 
 * Installation
 ** via package.el
@@ -127,11 +127,13 @@ E.g. for =org= style it makes links to be the same as 
their visible text:
 #+BEGIN_SRC org
   * About
   * Table of Contents                                           :TOC:
-    - [[#about][About]]
-    - [[#installation][Installation]]
-        - [[#via-packageel][via package.el]]
-        - [[#manual][Manual]]
-    - [[#use][Use]]
+  - [[#about][About]]
+  - [[#installation][Installation]]
+    - [[#via-packageel][via package.el]]
+    - [[#manual][Manual]]
+  - [[#use][Use]]
+  - [[#example][Example]]
+
   * Installation
   ** via package.el
   ** Manual
diff --git a/toc-org-test.el b/toc-org-test.el
index 34eb9d7be2..8384f929bf 100644
--- a/toc-org-test.el
+++ b/toc-org-test.el
@@ -136,18 +136,18 @@
     (should (equal (toc-org-hrefify-toc "* About\n"
                                         (lambda (str &optional hash) (upcase 
str))
                                         hash)
-                   " - [[ABOUT][About]]\n"))
+                   "- [[ABOUT][About]]\n"))
     (should (equal (gethash "ABOUT" hash) "About")))
   ;; check trailing space: https://github.com/snosov1/toc-org/pull/31
   (let ((hash (make-hash-table :test 'equal)))
     (should (equal (toc-org-hrefify-toc "* About  \n"
                                         (lambda (str &optional hash) (upcase 
str))
                                         hash)
-                   " - [[ABOUT][About]]\n"))
+                   "- [[ABOUT][About]]\n"))
     (should (equal (gethash "ABOUT" hash) "About")))
   (let ((hash (make-hash-table :test 'equal)))
     (should (equal (toc-org-hrefify-toc "* About\n* Installation\n** via 
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" (lambda 
(str &optional hash) (upcase str)) hash)
-                   " - [[ABOUT][About]]\n - [[INSTALLATION][Installation]]\n   
- [[VIA PACKAGE.EL][via package.el]]\n   - [[MANUAL][Manual]]\n - 
[[USE][Use]]\n - [[DIFFERENT HREF STYLES][Different href styles]]\n - 
[[EXAMPLE][Example]]\n"))
+                   "- [[ABOUT][About]]\n- [[INSTALLATION][Installation]]\n  - 
[[VIA PACKAGE.EL][via package.el]]\n  - [[MANUAL][Manual]]\n- [[USE][Use]]\n- 
[[DIFFERENT HREF STYLES][Different href styles]]\n- [[EXAMPLE][Example]]\n"))
     (should (equal (gethash "ABOUT" hash) "About"))
     (should (equal (gethash "INSTALLATION" hash) "Installation"))
     (should (equal (gethash "VIA PACKAGE.EL" hash) "via package.el"))
@@ -190,33 +190,33 @@
   (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
      (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   - [[#g [...]
+     "* 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  - [[#good [...]
 
     (test-toc-org-insert-toc-gold-test
      (concat beg ":TOC_1:")
-     "* 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_1:\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_1:\n- [[#about][About]]\n- [[#hello][Hello]]\n")
 
     (test-toc-org-insert-toc-gold-test
      (concat beg ":TOC_3:")
-     "* 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:\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:\n- [[#about][About]]\n- [[#hello][Hello]]\n  - [[#go [...]
 
     (test-toc-org-insert-toc-gold-test
      (concat beg ":TOC_1_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_1_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_1_org:\n- [[About][About]]\n- [[Hello][Hello]]\n")
 
     (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  - [[G [...]
 
     (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 [...]
+     "* 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- [[#about [...]
 
     (test-toc-org-insert-toc-gold-test
      "* H1\n* H2\n* TOC           :TOC:\n - [[#header-1][Header 1]]\n - 
[[#header-2][Header 2]]\n"
-     "* H1\n* H2\n* TOC           :TOC:\n - [[#h1][H1]]\n - [[#h2][H2]]\n")
+     "* H1\n* H2\n* TOC           :TOC:\n- [[#h1][H1]]\n- [[#h2][H2]]\n")
 
     (test-toc-org-insert-toc-gold-test
      "* H1\n* TODO H2\n* TOC           :TOC:\n \n"
-     "* H1\n* TODO H2\n* TOC           :TOC:\n - [[#h1][H1]]\n - 
[[#h2][H2]]\n")
+     "* H1\n* TODO H2\n* TOC           :TOC:\n- [[#h1][H1]]\n- [[#h2][H2]]\n")
     ))
diff --git a/toc-org.el b/toc-org.el
index 18263ceffe..ac912de18b 100644
--- a/toc-org.el
+++ b/toc-org.el
@@ -250,8 +250,8 @@ each heading into a link."
                        (+ 2 (or (bound-and-true-p org-list-indent-offset) 0))
                        ?\s)))
 
+            (insert "-")
             (skip-chars-forward " ")
-            (insert "- ")
 
            (save-excursion
              (delete-trailing-whitespace (point) (line-end-position)))



reply via email to

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