[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/toc-org c83c19ddb4 093/128: Merge pull request #59 from sn
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/toc-org c83c19ddb4 093/128: Merge pull request #59 from snosov1/add-quote |
Date: |
Sun, 2 Jan 2022 09:59:12 -0500 (EST) |
branch: elpa/toc-org
commit c83c19ddb4a5f4bfcc38203430f430c37cee9c14
Merge: ce9e49303c 2c4ff18a4e
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #59 from snosov1/add-quote
Add quote
---
README.org | 12 +++++++++++-
toc-org-test.el | 8 ++++++++
toc-org.el | 19 +++++++++++++------
3 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/README.org b/README.org
index 8897bc68d7..40934e3848 100644
--- a/README.org
+++ b/README.org
@@ -10,7 +10,8 @@ It is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]]
*NOTE:* Previous name of the package is =org-toc=. It was changed because of a
name conflict with one of the org contrib modules.
-* Table of Contents :TOC:
+* Table of Contents
:TOC:QUOTE:
+#+BEGIN_QUOTE
- [[#about][About]]
- [[#installation][Installation]]
- [[#via-packageel][via package.el]]
@@ -18,9 +19,11 @@ name conflict with one of the org contrib modules.
- [[#use][Use]]
- [[#follow-links][Follow links]]
- [[#exclude-headings][Exclude headings]]
+ - [[#quote-table-of-contents][Quote table of contents]]
- [[#shortcut-for-toc-tag][Shortcut for TOC tag]]
- [[#different-href-styles][Different href styles]]
- [[#example][Example]]
+#+END_QUOTE
* Installation
** via package.el
@@ -92,6 +95,13 @@ has a similar meaning in =org-mode=, which I hope is a Good
Thing (tm). However,
=:noexport_1:= and friends won't be recognized by =org-mode= as anything
special. Look at =org-export-exclude-tags= variable for more details.
+** Quote table of contents
+
+For presentation purposes, you might want to put the table of contents in a
+quote block (i.e. =#+BEGIN_QUOTE= / =#+END_QUOTE=). In that case, GitHub, for
+example, will add a vertical line to the left of the TOC that makes it distinct
+from the main text. To do this, just add a =:QUOTE:= tag to the TOC heading.
+
** Shortcut for TOC tag
In your emacs' setup, you can bind a tag =:TOC:= to a binding =T=:
diff --git a/toc-org-test.el b/toc-org-test.el
index 207a6cc798..a9b34a4157 100644
--- a/toc-org-test.el
+++ b/toc-org-test.el
@@ -217,6 +217,14 @@
(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- [[#about [...]
+ (test-toc-org-insert-toc-gold-test
+ (concat beg ":TOC_3:QUOTE:")
+ "* 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:QUOTE:\n#+BEGIN_QUOTE\n- [[#about][About]]\n- [[#hell [...]
+
+ (test-toc-org-insert-toc-gold-test
+ (concat beg ":QUOTE:hello:TOC_3_gh:")
+ "* 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
:QUOTE:hello:TOC_3_gh:\n#+BEGIN_QUOTE\n- [[#about][About]]\n [...]
+
(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")
diff --git a/toc-org.el b/toc-org.el
index 861a55ace9..63a35f7db2 100644
--- a/toc-org.el
+++ b/toc-org.el
@@ -54,6 +54,8 @@ files on GitHub)"
;; just in case, simple regexp "^*.*:toc:\\($\\|[^ ]*:$\\)"
(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-quote-tag-regexp "^*.*:quote:\\($\\|[^ ]*?:$\\)"
+ "Regexp to find the heading with the :quote: tag")
(defconst toc-org-noexport-regexp
"\\(^*+\\)\s+.*:noexport\\([@_][0-9]\\)?:\\($\\|[^ ]*?:$\\)"
"Regexp to find the extended version of :noexport: tag")
(defconst toc-org-tags-regexp "\s*:[[:word:]:@_]*:\s*$"
@@ -351,14 +353,19 @@ not :noexport_#:."
(downcase (substring tag 3))
toc-org-hrefify-default))
(hrefify-string (concat "toc-org-hrefify-" hrefify-tag))
- (hrefify (intern-soft hrefify-string)))
+ (hrefify (intern-soft hrefify-string))
+ (put-quote (save-match-data (string-match
toc-org-quote-tag-regexp (match-string 0))))
+ (toc-prefix (if put-quote "#+BEGIN_QUOTE\n" ""))
+ (toc-suffix (if put-quote "#+END_QUOTE\n" "")))
(if hrefify
(let ((new-toc
- (toc-org-hrefify-toc
- (toc-org-flush-subheadings (toc-org-raw-toc) depth)
- hrefify
- (when toc-org-hrefify-hash
- (clrhash toc-org-hrefify-hash)))))
+ (concat toc-prefix
+ (toc-org-hrefify-toc
+ (toc-org-flush-subheadings (toc-org-raw-toc)
depth)
+ hrefify
+ (when toc-org-hrefify-hash
+ (clrhash toc-org-hrefify-hash)))
+ toc-suffix)))
(unless dry-run
(newline (forward-line 1))
- [nongnu] elpa/toc-org 815c6d8c1b 044/128: flatten links when creating raw toc, (continued)
- [nongnu] elpa/toc-org 815c6d8c1b 044/128: flatten links when creating raw toc, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org e0cef2c6a1 027/128: print emacs version in travis log, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 8cf236450b 045/128: don't modify and save file on opening, ELPA Syncer, 2022/01/02
- [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 <=
- [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, 2022/01/02
- [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