summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-06-29 12:37:09 +0530
committerArun Isaac2022-06-29 12:37:09 +0530
commit608acfe0f019b6b964540298c13131fc9e12dd2a (patch)
tree2edb450b472c3a5b787189cd3f1d25a8f728429b
parentce28a461bbd15e5a89c1625de0543ca94cf30dd7 (diff)
downloadtissue-608acfe0f019b6b964540298c13131fc9e12dd2a.tar.gz
tissue-608acfe0f019b6b964540298c13131fc9e12dd2a.tar.lz
tissue-608acfe0f019b6b964540298c13131fc9e12dd2a.zip
document: Accept port argument when printing to text.
* tissue/document.scm (print): Accept port argument. * tissue/issue.scm (print): Accept port argument.
-rw-r--r--tissue/document.scm18
-rw-r--r--tissue/issue.scm40
2 files changed, 34 insertions, 24 deletions
diff --git a/tissue/document.scm b/tissue/document.scm
index f049a00..5b572ed 100644
--- a/tissue/document.scm
+++ b/tissue/document.scm
@@ -203,18 +203,20 @@ representing a list of search results."
children)
""))))
-(define-method (print (document <file-document>) mset)
+(define-method (print (document <file-document>) mset port)
"Print DOCUMENT in command-line search results. MSET is the xapian
MSet object representing a list of search results."
- (display (colorize-string (document-title document) 'MAGENTA 'UNDERLINE))
- (newline)
- (display (colorize-string (file-document-path document) 'YELLOW))
- (newline)
+ (display (colorize-string (document-title document) 'MAGENTA 'UNDERLINE)
+ port)
+ (newline port)
+ (display (colorize-string (file-document-path document) 'YELLOW)
+ port)
+ (newline port)
(let ((snippet (document-snippet document mset)))
(unless (string-null? snippet)
- (display snippet)
- (newline)
- (newline))))
+ (display snippet port)
+ (newline port)
+ (newline port))))
(define (document-sxml-snippet document mset)
"Return snippet in SXML form for DOCUMENT. MSET is the xapian MSet
diff --git a/tissue/issue.scm b/tissue/issue.scm
index 54daf28..6f03b36 100644
--- a/tissue/issue.scm
+++ b/tissue/issue.scm
@@ -95,33 +95,39 @@
#:prefix "XS")
term-generator))
-(define-method (print (issue <issue>) mset)
+(define-method (print (issue <issue>) mset port)
"Print ISSUE, an <issue> object, in search results."
(let ((number-of-posts (length (issue-posts issue))))
- (display (colorize-string (document-title issue) 'MAGENTA 'UNDERLINE))
+ (display (colorize-string (document-title issue) 'MAGENTA 'UNDERLINE)
+ port)
(unless (null? (issue-keywords issue))
- (display " ")
+ (display " " port)
(display (string-join (map (cut colorize-string <> 'ON-BLUE)
(issue-keywords issue))
- " ")))
+ " ")
+ port))
(unless (null? (issue-assigned issue))
(display (colorize-string (string-append " (assigned: "
(string-join (issue-assigned issue)
", ")
")")
- 'GREEN)))
+ 'GREEN)
+ port))
(when (> number-of-posts 1)
(display (string-append " ["
(number->string number-of-posts)
- " posts]")))
- (newline)
- (display (colorize-string (file-document-path issue) 'YELLOW))
- (newline)
+ " posts]")
+ port))
+ (newline port)
+ (display (colorize-string (file-document-path issue) 'YELLOW)
+ port)
+ (newline port)
(display (string-append
"opened "
(colorize-string (human-date-string (issue-created-date issue)) 'CYAN)
" by "
- (colorize-string (issue-creator issue) 'CYAN)))
+ (colorize-string (issue-creator issue) 'CYAN))
+ port)
(when (> number-of-posts 1)
(display (string-append (colorize-string "," 'CYAN)
" last updated "
@@ -129,19 +135,21 @@
'CYAN)
" by "
(colorize-string (issue-last-updater issue)
- 'CYAN))))
+ 'CYAN))
+ port))
(unless (zero? (issue-tasks issue))
(display (string-append (colorize-string "; " 'CYAN)
(number->string (issue-completed-tasks issue))
"/"
(number->string (issue-tasks issue))
- " tasks done")))
- (newline)
+ " tasks done")
+ port))
+ (newline port)
(let ((snippet (document-snippet issue mset)))
(unless (string-null? snippet)
- (display snippet)
- (newline)
- (newline)))))
+ (display snippet port)
+ (newline port)
+ (newline port)))))
(define (print-issue-to-gemtext issue)
"Print ISSUE to gemtext."