diff options
Diffstat (limited to 'tissue/commit.scm')
-rw-r--r-- | tissue/commit.scm | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/tissue/commit.scm b/tissue/commit.scm index 3dfd45f..b910695 100644 --- a/tissue/commit.scm +++ b/tissue/commit.scm @@ -1,5 +1,5 @@ ;;; tissue --- Text based issue tracker -;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2022, 2023 Arun Isaac <arunisaac@systemreboot.net> ;;; ;;; This file is part of tissue. ;;; @@ -39,7 +39,7 @@ (author-date #:getter doc:commit-author-date #:init-keyword #:author-date)) (define-method (document-id-term (commit <commit>)) - "Return the ID term for DOCUMENT." + "Return the ID term for COMMIT." (string-append "Qcommit." (commit-hash commit))) (define-method (document-boolean-terms (commit <commit>)) @@ -48,16 +48,9 @@ (string-append "A" (doc:commit-author commit)))) (define-method (document-recency-date (commit <commit>)) - "Return a date representing the recency of DOCUMENT" + "Return a date representing the recency of COMMIT." (doc:commit-author-date commit)) -(define-method (document-snippet-source-text (commit <commit>)) - "Return the source text for COMMIT from which to extract a search -result snippet." - (commit-body - (commit-lookup (current-git-repository) - (string->oid (commit-hash commit))))) - (define-method (document-text (commit <commit>)) "Return the full text of COMMIT." (commit-message @@ -90,26 +83,6 @@ search results." (newline port) (newline port)))) -(define-method (document->sxml (commit <commit>) mset) - "Render COMMIT, a <commit> object, to SXML. MSET is the xapian MSet -object representing a list of search results." - `(li (@ (class ,(string-append "search-result search-result-commit"))) - (a (@ (href ,(document-web-uri commit)) - (class "search-result-title")) - ,(document-title commit)) - (div (@ (class "search-result-metadata")) - (span (@ (class ,(string-append "document-type commit-document-type"))) - "commit") - ,(string-append - (format #f " authored ~a by ~a" - (human-date-string (doc:commit-author-date commit)) - (doc:commit-author commit)))) - ,@(let ((snippet (document-sxml-snippet commit mset))) - (if snippet - (list `(div (@ (class "search-result-snippet")) - ,@snippet)) - (list))))) - (define (repository-commits repository) "Return a list of <commit> objects representing commits in REPOSITORY." @@ -119,7 +92,14 @@ REPOSITORY." #:hash (oid->string (commit-id commit)) #:author (resolve-alias (signature-name (commit-author commit)) (%aliases)) - #:author-date (commit-author-date commit)) + #:author-date (commit-author-date commit) + ;; The snippet source text excludes the + ;; first paragraph (i.e., the summary line) + ;; of the commit. Hence, we use commit-body. + #:snippet-source-text + (commit-body + (commit-lookup (current-git-repository) + (commit-id commit)))) result)) (list) repository)) |