summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2022-07-09 11:03:02 +0530
committerArun Isaac2022-07-09 16:41:01 +0530
commita132df19eabf5d77b0eac7e870178803f1b0dd07 (patch)
tree5aaf88f84dd9e71c903cc558c4c594148afdbf33
parent9dfd2836909cfbb7fc1d2fcc2b13ba42b680fe72 (diff)
downloadtissue-a132df19eabf5d77b0eac7e870178803f1b0dd07.tar.gz
tissue-a132df19eabf5d77b0eac7e870178803f1b0dd07.tar.lz
tissue-a132df19eabf5d77b0eac7e870178803f1b0dd07.zip
document: Generalize document-type method of <document> parent class.
* tissue/document.scm (document-type): Generalize generic method of
<document> to apply to most child classes. Pass on generic method of
<file-document> to that of <document>.
* tissue/issue.scm (document-type): Remove generic method for <issue>
class.
-rw-r--r--tissue/document.scm6
-rw-r--r--tissue/issue.scm3
2 files changed, 5 insertions, 4 deletions
diff --git a/tissue/document.scm b/tissue/document.scm
index e46e055..b12ccbb 100644
--- a/tissue/document.scm
+++ b/tissue/document.scm
@@ -137,7 +137,8 @@ that operates on a copy of OBJECT. It does not mutate OBJECT."
   (web-uri #:accessor document-web-uri #:init-keyword #:web-uri))
 
 (define-method (document-type (document <document>))
-  "document")
+  (string-trim-both (symbol->string (class-name (class-of document)))
+                    (char-set #\< #\>)))
 
 (define-method (document-term-generator (document <document>))
   "Return a term generator for DOCUMENT. The returned term generator has
@@ -158,6 +159,9 @@ and further text, increase-termpos! must be called before indexing."
 (define-class <file-document> (<document>)
   (path #:accessor file-document-path #:init-keyword #:path))
 
+(define-method (document-type (document <file-document>))
+  (next-method))
+
 (define-method (document-id-term (document <file-document>))
   "Return the ID term for DOCUMENT."
   (string-append "Q" (file-document-path document)))
diff --git a/tissue/issue.scm b/tissue/issue.scm
index 2bc6b41..bbfe2cf 100644
--- a/tissue/issue.scm
+++ b/tissue/issue.scm
@@ -78,9 +78,6 @@
   (author #:accessor post-author #:init-keyword #:author)
   (date #:accessor post-date #:init-keyword #:date))
 
-(define-method (document-type (issue <issue>))
-  "issue")
-
 (define-method (document-term-generator (issue <issue>))
   "Return a term generator indexing ISSUE."
   (let ((term-generator (next-method)))