[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/toc-org 56b48ec37b 033/128: rename to toc-org
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/toc-org 56b48ec37b 033/128: rename to toc-org |
Date: |
Sun, 2 Jan 2022 09:59:07 -0500 (EST) |
branch: elpa/toc-org
commit 56b48ec37bec1b610b41ee4a645f55797f57853b
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: Sergei Nosov <sergei.nosov@gmail.com>
rename to toc-org
---
README.org | 34 +++++-------
org-toc.el => toc-org.el | 135 +++++++++++++++++++++++------------------------
2 files changed, 80 insertions(+), 89 deletions(-)
diff --git a/README.org b/README.org
index 1e64727795..2d60e350df 100644
--- a/README.org
+++ b/README.org
@@ -1,10 +1,8 @@
-[[https://travis-ci.org/snosov1/org-toc][file:https://api.travis-ci.org/snosov1/org-toc.svg?branch=master]]
-
-#+TITLE: NOTE: The package was renamed to toc-org and moved to
https://github.com/snosov1/toc-org Please, update your configuration files!
+[[https://travis-ci.org/snosov1/toc-org][file:https://api.travis-ci.org/snosov1/toc-org.svg?branch=master]]
* About
-org-toc 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.
@@ -14,7 +12,6 @@ It is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]]
- [[#installation][Installation]]
- [[#via-packageel][via package.el]]
- [[#manual][Manual]]
- - [[#potential-name-conflict][Potential name conflict]]
- [[#use][Use]]
- [[#different-href-styles][Different href styles]]
- [[#example][Example]]
@@ -29,31 +26,26 @@ Emacs 24.1) you can simply use =M-x package-install= after
setting up the [[http
repository and then put the following snippet in your ~/.emacs file
#+BEGIN_SRC elisp
- (if (require 'org-toc nil t)
- (add-hook 'org-mode-hook 'org-toc-enable)
- (warn "org-toc not found"))
+ (if (require 'toc-org nil t)
+ (add-hook 'org-mode-hook 'toc-org-enable)
+ (warn "toc-org not found"))
#+END_SRC
** Manual
- Create folder ~/.emacs.d if you don't have it
-- Go to it and clone org-toc there
+- Go to it and clone toc-org there
#+BEGIN_SRC sh
- git clone https://github.com/snosov1/org-toc.git
+ git clone https://github.com/snosov1/toc-org.git
#+END_SRC
- Put this in your ~/.emacs file
#+BEGIN_SRC elisp
- (add-to-list 'load-path "~/.emacs.d/org-toc")
- (if (require 'org-toc nil t)
- (add-hook 'org-mode-hook 'org-toc-enable)
- (warn "org-toc not found"))
+ (add-to-list 'load-path "~/.emacs.d/toc-org")
+ (if (require 'toc-org nil t)
+ (add-hook 'org-mode-hook 'toc-org-enable)
+ (warn "toc-org not found"))
#+END_SRC
-** Potential name conflict
-
-If you install =contrib= Org modules, you may face a name conflict, since
-there's a package with the same name there.
-
* Use
After the installation, every time you'll be saving an org file, the first
@@ -88,13 +80,13 @@ Now =C-c C-q T RET= and you are done putting the =:TOC:=
entry.
Currently, only 2 href styles are supported: =gh= and =org=. You can easily
define your own styles. If you use the tag =:TOC_2_STYLE:= (=STYLE= being a
style name), then the package will look for a function named
-=org-toc-hrefify-STYLE=, which accepts a heading string and returns a href
+=toc-org-hrefify-STYLE=, which accepts a heading string and returns a href
corresponding to that heading.
E.g. for =org= style it simply returns input as is:
#+BEGIN_SRC emacs-lisp
- (defun org-toc-hrefify-org (str)
+ (defun toc-org-hrefify-org (str)
"Given a heading, transform it into a href using the org-mode
rules."
str)
diff --git a/org-toc.el b/toc-org.el
similarity index 72%
rename from org-toc.el
rename to toc-org.el
index 3369a0ba10..f09aef9dd5 100644
--- a/org-toc.el
+++ b/toc-org.el
@@ -1,11 +1,11 @@
-;;; org-toc.el --- add table of contents to org-mode files
+;;; toc-org.el --- add table of contents to org-mode files
;; Copyright (C) 2014 Sergei Nosov
;; Author: Sergei Nosov <sergei.nosov [at] gmail.com>
;; Version: 1.0
;; Keywords: org-mode org toc table of contents
-;; URL: https://github.com/snosov1/org-toc
+;; URL: https://github.com/snosov1/toc-org
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
@@ -24,50 +24,50 @@
;;; Commentary:
-;; org-toc helps you to have an up-to-date table of contents in org files
+;; 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).
;; After installation put into your .emacs file something like
-;; (if (require 'org-toc nil t)
-;; (add-hook 'org-mode-hook 'org-toc-enable)
-;; (warn "org-toc not found"))
+;; (if (require 'toc-org nil t)
+;; (add-hook 'org-mode-hook 'toc-org-enable)
+;; (warn "toc-org not found"))
;; And every time you'll be saving an org file, the first headline with a :TOC:
;; tag will be updated with the current table of contents.
-;; For details, see https://github.com/snosov1/org-toc
+;; For details, see https://github.com/snosov1/toc-org
;;; Code:
(require 'ert)
-(defgroup org-toc nil
- "org-toc is a utility to have an up-to-date table of contents
+(defgroup toc-org nil
+ "toc-org is a utility to have an up-to-date table of contents
in the org files without exporting (useful primarily for readme
files on GitHub)"
:group 'org)
;; just in case, simple regexp "^*.*:toc:\\($\\|[^ ]*:$\\)"
-(defconst org-toc-org-toc-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 org-toc-tags-regexp "\s*:[[:word:]:@]*:\s*$"
+(defconst toc-org-tags-regexp "\s*:[[:word:]:@]*:\s*$"
"Regexp to find tags on the line")
-(defconst org-toc-special-chars-regexp "[][~`!@#$%^&*()+={}|\:;\"'<,>.?/]"
+(defconst toc-org-special-chars-regexp "[][~`!@#$%^&*()+={}|\:;\"'<,>.?/]"
"Regexp with the special characters (which are omitted in hrefs
by GitHub)")
-(defcustom org-toc-max-depth 2
+(defcustom toc-org-max-depth 2
"Maximum depth of the headings to use in the table of
contents. The default of 2 uses only the highest level headings
and their subheadings (one and two stars)."
- :group 'org-toc)
+ :group 'toc-org)
-(defcustom org-toc-hrefify-default "gh"
+(defcustom toc-org-hrefify-default "gh"
"Default hrefify function to use."
- :group 'org-toc)
+ :group 'toc-org)
-(defun org-toc-raw-toc ()
+(defun toc-org-raw-toc ()
"Return the \"raw\" table of contents of the current file,
i.e. simply flush everything that's not a heading and strip
tags."
@@ -80,7 +80,7 @@ tags."
;; don't include the TOC itself
(goto-char (point-min))
- (re-search-forward org-toc-org-toc-regexp)
+ (re-search-forward toc-org-toc-org-regexp)
(beginning-of-line)
(delete-region (point) (progn (forward-line 1) (point)))
@@ -89,63 +89,63 @@ tags."
;; TODO :export: and :noexport: tags semantic should be probably
;; implemented
(goto-char (point-min))
- (while (re-search-forward org-toc-tags-regexp nil t)
+ (while (re-search-forward toc-org-tags-regexp nil t)
(replace-match "" nil nil))
(buffer-substring-no-properties
(point-min) (point-max)))))
-(ert-deftest org-toc-test-raw-toc ()
- "Test the `org-toc-raw-toc' function"
+(ert-deftest toc-org-test-raw-toc ()
+ "Test the `toc-org-raw-toc' function"
- (defun org-toc-test-raw-toc-gold-test (content gold)
+ (defun toc-org-test-raw-toc-gold-test (content gold)
(should (equal
(with-temp-buffer
(insert content)
- (org-toc-raw-toc))
+ (toc-org-raw-toc))
gold)))
- (declare-function org-toc-test-raw-toc-gold-test "org-toc") ;; suppress
compiler warning
+ (declare-function toc-org-test-raw-toc-gold-test "toc-org") ;; suppress
compiler warning
- (let ((beg "* About\n:TOC:\n drawer\n:END:\n\norg-toc 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\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\n* Table of Contents
")
(gold "* About\n"))
;; different TOC styles
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC_1:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC_1_qqq:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1@cxv:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" ) gold)
+ (toc-org-test-raw-toc-gold-test (concat beg ":TOC:" ) gold)
+ (toc-org-test-raw-toc-gold-test (concat beg ":TOC_1:" ) gold)
+ (toc-org-test-raw-toc-gold-test (concat beg ":TOC_1_qqq:" ) gold)
+ (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1:" ) gold)
+ (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1@cxv:" ) gold)
+ (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" ) gold)
;; trailing symbols
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\n") gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\nsdfd")
gold))
+ (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\n") gold)
+ (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\nsdfd")
gold))
;; more complex case
- (org-toc-test-raw-toc-gold-test
- "* About\n:TOC:\n drawer\n:END:\n\norg-toc 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\n* Table of Contents
:TOC:\n - [[#about][About]]\n -
[[#use][Use]]\n - [[#different-href-styles][Different href st [...]
+ (toc-org-test-raw-toc-gold-test
+ "* 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\n* Table of Contents
:TOC:\n - [[#about][About]]\n -
[[#use][Use]]\n - [[#different-href-styles][Different href st [...]
"* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different
href styles\n* Example\n"))
-(defun org-toc-hrefify-gh (str)
+(defun toc-org-hrefify-gh (str)
"Given a heading, transform it into a href using the GitHub
rules."
(let* ((spc-fix (replace-regexp-in-string " " "-" str))
(upcase-fix (replace-regexp-in-string "[A-Z]" 'downcase spc-fix t))
- (special-chars-fix (replace-regexp-in-string
org-toc-special-chars-regexp "" upcase-fix t)))
+ (special-chars-fix (replace-regexp-in-string
toc-org-special-chars-regexp "" upcase-fix t)))
(concat "#" special-chars-fix)))
-(ert-deftest org-toc-test-hrefify-gh ()
- "Test the `org-toc-hrefify-gh' function"
- (should (equal (org-toc-hrefify-gh "About") "#about"))
- (should (equal (org-toc-hrefify-gh "!h@#$%^&*(){}|][:;\"'/?.>,<`~") "#h"))
- (should (equal (org-toc-hrefify-gh "!h@#$% ^&*(S){}|][:;\"'/?.>,<`~")
"#h-s")))
+(ert-deftest toc-org-test-hrefify-gh ()
+ "Test the `toc-org-hrefify-gh' function"
+ (should (equal (toc-org-hrefify-gh "About") "#about"))
+ (should (equal (toc-org-hrefify-gh "!h@#$%^&*(){}|][:;\"'/?.>,<`~") "#h"))
+ (should (equal (toc-org-hrefify-gh "!h@#$% ^&*(S){}|][:;\"'/?.>,<`~")
"#h-s")))
-(defun org-toc-hrefify-org (str)
+(defun toc-org-hrefify-org (str)
"Given a heading, transform it into a href using the org-mode
rules."
str)
-(defun org-toc-hrefify-toc (toc hrefify)
+(defun toc-org-hrefify-toc (toc hrefify)
"Format the raw `toc' using the `hrefify' function to transform
each heading into a link."
(with-temp-buffer
@@ -178,13 +178,13 @@ each heading into a link."
(buffer-substring-no-properties
(point-min) (point-max))))
-(ert-deftest org-toc-test-hrefify-toc ()
- (should (equal (org-toc-hrefify-toc "* About\n" 'upcase)
+(ert-deftest toc-org-test-hrefify-toc ()
+ (should (equal (toc-org-hrefify-toc "* About\n" 'upcase)
" - [[ABOUT][About]]\n"))
- (should (equal (org-toc-hrefify-toc "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 'upcase)
+ (should (equal (toc-org-hrefify-toc "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 'upcase)
" - [[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")))
-(defun org-toc-flush-subheadings (toc max-depth)
+(defun toc-org-flush-subheadings (toc max-depth)
"Flush subheadings of the raw `toc' deeper than `max-depth'."
(with-temp-buffer
(insert toc)
@@ -198,24 +198,24 @@ each heading into a link."
(buffer-substring-no-properties
(point-min) (point-max))))
-(ert-deftest org-toc-test-flush-subheadings ()
- (should (equal (org-toc-flush-subheadings "* About\n" 0)
+(ert-deftest toc-org-test-flush-subheadings ()
+ (should (equal (toc-org-flush-subheadings "* About\n" 0)
""))
- (should (equal (org-toc-flush-subheadings "* About\n" 1)
+ (should (equal (toc-org-flush-subheadings "* About\n" 1)
"* About\n"))
- (should (equal (org-toc-flush-subheadings "* About\n" 2)
+ (should (equal (toc-org-flush-subheadings "* About\n" 2)
"* About\n"))
- (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 0)
+ (should (equal (toc-org-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 0)
""))
- (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 1)
+ (should (equal (toc-org-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 1)
"* About\n* Installation\n* Use\n* Different href styles\n*
Example\n"))
- (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 2)
+ (should (equal (toc-org-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 2)
"* About\n* Installation\n** via package.el\n** Manual\n*
Use\n* Different href styles\n* Example\n"))
- (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 3)
+ (should (equal (toc-org-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 3)
"* About\n* Installation\n** via package.el\n** Manual\n*
Use\n* Different href styles\n* Example\n")))
-(defun org-toc-insert-toc ()
+(defun toc-org-insert-toc ()
"Looks for a headline with the TOC tag and updates it with the
current table of contents.
@@ -239,16 +239,16 @@ following tag formats:
(goto-char (point-min))
(let ((case-fold-search t))
;; find the first heading with the :TOC: tag
- (when (re-search-forward org-toc-org-toc-regexp (point-max) t)
+ (when (re-search-forward toc-org-toc-org-regexp (point-max) t)
(let* ((tag (match-string 1))
(depth (if tag
(- (aref tag 1) ?0) ;; is there a better way to
convert char to number?
- org-toc-max-depth))
+ toc-org-max-depth))
(hrefify-tag (if (and tag (>= (length tag) 4))
(downcase (substring tag 3))
- org-toc-hrefify-default))
- (hrefify-string (concat "org-toc-hrefify-" hrefify-tag))
+ toc-org-hrefify-default))
+ (hrefify-string (concat "toc-org-hrefify-" hrefify-tag))
(hrefify (intern-soft hrefify-string)))
(if hrefify
(progn
@@ -266,18 +266,17 @@ following tag formats:
(end-of-line)
(point)))
- (insert (org-toc-hrefify-toc (org-toc-flush-subheadings
(org-toc-raw-toc) depth) hrefify)))
+ (insert (toc-org-hrefify-toc (toc-org-flush-subheadings
(toc-org-raw-toc) depth) hrefify)))
(message (concat "Hrefify function " hrefify-string " is not
found")))))))))
;;;###autoload
-(defun org-toc-enable ()
- "Enable org-toc in this buffer."
- (add-hook 'before-save-hook 'org-toc-insert-toc nil t))
+(defun toc-org-enable ()
+ "Enable toc-org in this buffer."
+ (add-hook 'before-save-hook 'toc-org-insert-toc nil t))
;; 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"
;; End:
-(provide 'org-toc-2)
-(provide 'org-toc)
-;;; org-toc.el ends here
+(provide 'toc-org)
+;;; toc-org.el ends here
- [nongnu] elpa/toc-org 114dcc9813 053/128: make GitHub hrefs unique (fixes #16), (continued)
- [nongnu] elpa/toc-org 114dcc9813 053/128: make GitHub hrefs unique (fixes #16), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 72883a08b0 049/128: update the TOC only if it's actually different from the current one, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 4e4b4e6484 057/128: generate correct toc when it's the last heading, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 4380d99113 065/128: add unit test for #31, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 970560a874 069/128: fix travis build, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 39d983c381 074/128: add noexport support, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 663e5ec281 116/128: Correct sample configuration to valid code, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org c83c19ddb4 093/128: Merge pull request #59 from snosov1/add-quote, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 35781c6313 126/128: Merge pull request #82 from skangas/add-license, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 08ed3f0883 061/128: Merge pull request #30 from snosov1/fix-28, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 56b48ec37b 033/128: rename to toc-org,
ELPA Syncer <=
- [nongnu] elpa/toc-org 11ce8a843f 052/128: strip priorities (fixes #18), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org a19c3f5f94 091/128: test quote functionality, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 32975071df 039/128: mention former name in description, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org c662f96040 090/128: add quote functionality, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 4cd71edc29 082/128: bump emacs25 version, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 827dc448e0 013/128: push .travis.yml, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 11be82816a 019/128: Merge pull request #4 from ardumont/add-tag-setup, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org b4dbeb936c 024/128: simply require ert, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 3dd30029b6 043/128: strip TODO and DONE states, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 7eb2874ed3 041/128: require org, ELPA Syncer, 2022/01/02