diff --git a/README.md b/README.md index fa01d6f..d851e51 100644 --- a/README.md +++ b/README.md @@ -58,12 +58,12 @@ TODO - **documentation/feature**: use post-update rather than post-receive hook for simplicity - **documentation**: also describe use with post-commit hook - **feature**: multi-page or collapse-able files list -- **feature**: commit log - **feature**: branches and releases (tags) - **feature**: clickable line numbers in source files - **feature**: customizable templates - **feature**: display binary files as output from binary-file analysis tools like hexdump, xxd, dumpelf, elfls, readelf, etc.? - **feature**: syntax highlighting? +- **bug**: markdown-render and/or html-escape git log text ## license: agpl-3.0+ diff --git a/main.scm b/main.scm index b5cdc32..84939fc 100755 --- a/main.scm +++ b/main.scm @@ -65,6 +65,10 @@ hr { border-bottom: 1px solid black; margin-top: 16px; } +td { + padding: 0em .5em; + vertical-align: top; +} ##file-path { /* change this to your liking */ } @@ -84,6 +88,7 @@ hr { (string-append "license")) ((member "LICENSE.md" source-files-list) (string-append "license"))) +commits contributors
@@ -166,14 +171,29 @@ string-block source-files-list) (display "\n")) +(define (display-commits-html) + (SXML->HTML + `((h1 "Commits") + (table + (tr (th "Date") (th "Ref") (th "Log") (th "Author")) + ,(map + (lambda (line) + (let-values (((date ref title author) (apply values (string-split line "\t")))) + `(tr (td ,date) (td ,ref) (td ,title) (td ,author)))) + (call-with-input-pipe + "git log --format=format:%as%x09%h%x09%s%x09%aN HEAD" + read-lines)))))) + (define (display-contributors-html) (SXML->HTML `((h1 "Contributors") - (ul ,(map - (lambda (line) - (let-values (((commits . author) (apply values (string-split line "\t")))) - `(li ,author))) - (call-with-input-pipe "git shortlog -ns HEAD" read-lines)))))) + (table + (tr (th "Author") (th "Commits")) + ,(map + (lambda (line) + (let-values (((commits . author) (apply values (string-split line "\t")))) + `(tr (td ,author) (td ,commits)))) + (call-with-input-pipe "git shortlog -ns HEAD" read-lines)))))) (define (first-if pred lst) (cond ((null? lst) #f) @@ -195,6 +215,7 @@ string-block ;; special files (write-with-template "files.html" (lambda () (display-files-html source-files-list))) (write-with-template "contributors.html" display-contributors-html) + (write-with-template "commits.html" display-commits-html) ;; htmlified repo contents (for-each (lambda (source-file)