summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-07-09 00:27:26 +0530
committerArun Isaac2022-07-09 00:30:20 +0530
commit526f422ce50823f7d78be1857f4538f600ffafd9 (patch)
tree2de49682138792d1dd802725347eab0e34953f54
parent1a328b0c5f6048cd670774860caeb5e45e05f1e1 (diff)
downloadtissue-526f422ce50823f7d78be1857f4538f600ffafd9.tar.gz
tissue-526f422ce50823f7d78be1857f4538f600ffafd9.tar.lz
tissue-526f422ce50823f7d78be1857f4538f600ffafd9.zip
bin: Make indexed documents a list of document objects.
This simplifies the interface obviating the need for an <indexed-document> type. * bin/tissue: Do not import (srfi srfi-9). (<indexed-document>): Delete type. (index): Expect indexed documents to be a list of document objects. * tissue.scm (#:indexed-documents): Pass in a list of document objects, instead of a list of <indexed-document> objects.
-rwxr-xr-xbin/tissue18
-rw-r--r--tissue.scm5
2 files changed, 5 insertions, 18 deletions
diff --git a/bin/tissue b/bin/tissue
index 9ab6330..4d91ba9 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -24,7 +24,6 @@ exec guile --no-auto-compile -s "$0" "$@"
(rnrs exceptions)
(rnrs io ports)
(srfi srfi-1)
- (srfi srfi-9)
(srfi srfi-26)
(srfi srfi-37)
(srfi srfi-171)
@@ -54,16 +53,6 @@ exec guile --no-auto-compile -s "$0" "$@"
(define %xapian-index
(string-append %state-directory "/xapian"))
-(define-record-type <indexed-document>
- (indexed-document reader web-uri)
- indexed-document?
- ;; A thunk that returns a document object (currently either an
- ;; <issue> or a <document> object), presumably by reading it from a
- ;; file or other source
- (reader indexed-document-reader)
- ;; A string URI linking to this document on the web
- (web-uri indexed-document-web-uri))
-
(define (invalid-option opt name arg loads)
(error "Invalid option" name))
@@ -333,11 +322,8 @@ To get usage information for one of these sub-commands, run
(delete-file-recursively db-path)
(call-with-writable-database db-path
(lambda (db)
- (for-each (lambda (indexed-document)
- (let* ((document (slot-set ((indexed-document-reader indexed-document))
- 'web-uri
- (indexed-document-web-uri indexed-document)))
- (term-generator (document-term-generator document)))
+ (for-each (lambda (document)
+ (let ((term-generator (document-term-generator document)))
(index-text! term-generator (document-type document) #:prefix "XT")
(replace-document! db
(document-id-term document)
diff --git a/tissue.scm b/tissue.scm
index 08522b4..69dba6f 100644
--- a/tissue.scm
+++ b/tissue.scm
@@ -1,8 +1,9 @@
(tissue-configuration
#:project "tissue"
#:indexed-documents (map (lambda (filename)
- (indexed-document (cut read-gemtext-issue filename)
- (string-append "/" (string-remove-suffix ".gmi" filename))))
+ (slot-set (read-gemtext-issue filename)
+ 'web-uri
+ (string-append "/" (string-remove-suffix ".gmi" filename))))
(gemtext-files-in-directory "issues"))
#:web-files (cons (file "index.html"
(skribe-exporter "website/index.skb"))