summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/tissue1
-rw-r--r--tissue/issue.scm26
-rw-r--r--tissue/person.scm48
3 files changed, 51 insertions, 24 deletions
diff --git a/bin/tissue b/bin/tissue
index edd5d52..f457806 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -41,6 +41,7 @@ exec guile --no-auto-compile -s "$0" "$@"
(tissue document)
(tissue git)
(tissue issue)
+ (tissue person)
(tissue search)
(tissue tissue)
(tissue utils)
diff --git a/tissue/issue.scm b/tissue/issue.scm
index bbfe2cf..a77e57a 100644
--- a/tissue/issue.scm
+++ b/tissue/issue.scm
@@ -32,9 +32,9 @@
#:use-module (xapian xapian)
#:use-module (tissue document)
#:use-module (tissue git)
+ #:use-module (tissue person)
#:use-module (tissue utils)
- #:export (%aliases
- <issue>
+ #:export (<issue>
issue-creator
issue-created-date
issue-last-updater
@@ -58,9 +58,6 @@
read-gemtext-issue
index-issue))
-(define %aliases
- (make-parameter #f))
-
(define-class <issue> (<file-document>)
(creator #:accessor issue-creator #:init-keyword #:creator)
(created-date #:accessor issue-created-date #:init-keyword #:created-date)
@@ -300,18 +297,6 @@ return #f."
'()
(comma-split (string-remove-prefix "* " line)))))
-(define (resolve-alias name aliases)
- "Resolve NAME against ALIASES, a list of aliases. ALIASES should be
-in the form of the argument of the same name to `tissue-configuration'
-in (tissue tissue). If no alias is found, NAME is returned as such."
- (cond
- ((find (cut member name <>)
- aliases)
- => (match-lambda
- ((canonical-name _ ...) canonical-name)
- (() name)))
- (else name)))
-
(define (file-details port)
"Return a hashtable of details extracted from input PORT reading a
gemtext file."
@@ -413,10 +398,3 @@ gemtext file."
#:date (commit-date commit)))
commits
commit-authors))))
-
-(define (index-person! term-generator name prefix)
- "Index all aliases of person of canonical NAME using TERM-GENERATOR
-with PREFIX."
- (for-each (cut index-text! term-generator <> #:prefix prefix)
- (or (assoc name (%aliases))
- (list))))
diff --git a/tissue/person.scm b/tissue/person.scm
new file mode 100644
index 0000000..e1c0ae1
--- /dev/null
+++ b/tissue/person.scm
@@ -0,0 +1,48 @@
+;;; tissue --- Text based issue tracker
+;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of tissue.
+;;;
+;;; tissue is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; tissue is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with tissue. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (tissue person)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:use-module (ice-9 match)
+ #:use-module (xapian xapian)
+ #:export (%aliases
+ resolve-alias
+ index-person!))
+
+(define %aliases
+ (make-parameter #f))
+
+(define (resolve-alias name aliases)
+ "Resolve NAME against ALIASES, a list of aliases. ALIASES should be
+in the form of the argument of the same name to `tissue-configuration'
+in (tissue tissue). If no alias is found, NAME is returned as such."
+ (cond
+ ((find (cut member name <>)
+ aliases)
+ => (match-lambda
+ ((canonical-name _ ...) canonical-name)
+ (() name)))
+ (else name)))
+
+(define (index-person! term-generator name prefix)
+ "Index all aliases of person of canonical NAME using TERM-GENERATOR
+with PREFIX."
+ (for-each (cut index-text! term-generator <> #:prefix prefix)
+ (or (assoc name (%aliases))
+ (list))))