today i learned cute/cut (srfi-26, built in to chicken) for sorta-currying
This commit is contained in:
parent
696ed31f85
commit
fbc6c6c8f4
1 changed files with 7 additions and 11 deletions
18
main.scm
18
main.scm
|
@ -110,13 +110,9 @@
|
||||||
(let ((linkurl (alist-ref 'href (alist-ref '@ i))))
|
(let ((linkurl (alist-ref 'href (alist-ref '@ i))))
|
||||||
`(,t .
|
`(,t .
|
||||||
,(if (and adjust-relative
|
,(if (and adjust-relative
|
||||||
(not (string-prefix? "#" linkurl))
|
(not (any
|
||||||
(not (string-prefix? "/" linkurl))
|
(cute string-prefix? <> linkurl)
|
||||||
(not (string-prefix? "https://" linkurl))
|
'("#" "/" "https://" "http://" "mailto:" "https://"))))
|
||||||
(not (string-prefix? "http://" linkurl))
|
|
||||||
(not (string-prefix? "mailto:" linkurl))
|
|
||||||
(not (string-prefix? "https://" linkurl)))
|
|
||||||
|
|
||||||
(alist-update '@
|
(alist-update '@
|
||||||
(alist-update 'href `(,adjust-relative ,linkurl) (alist-ref '@ i))
|
(alist-update 'href `(,adjust-relative ,linkurl) (alist-ref '@ i))
|
||||||
i)
|
i)
|
||||||
|
@ -138,7 +134,7 @@
|
||||||
"-\t-\t"
|
"-\t-\t"
|
||||||
(call-with-input-pipe
|
(call-with-input-pipe
|
||||||
(string-append "git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 --numstat HEAD -- " source-file)
|
(string-append "git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 --numstat HEAD -- " source-file)
|
||||||
(lambda (port) (read-line port 4))))))
|
(cute read-line <> 4)))))
|
||||||
|
|
||||||
(define (git-repository->paths-list)
|
(define (git-repository->paths-list)
|
||||||
(call-with-input-pipe "git ls-tree -r --name-only HEAD" read-lines))
|
(call-with-input-pipe "git ls-tree -r --name-only HEAD" read-lines))
|
||||||
|
@ -281,15 +277,15 @@
|
||||||
. ,(pathname-strip-directory (string-chomp html-repo-path "/")))
|
. ,(pathname-strip-directory (string-chomp html-repo-path "/")))
|
||||||
;; the first README file found, if any.
|
;; the first README file found, if any.
|
||||||
(readme_file
|
(readme_file
|
||||||
. ,(find (lambda (x) (member x source-files-list))
|
. ,(find (cut member <> source-files-list)
|
||||||
'("README" "README.md" "README.txt")))
|
'("README" "README.md" "README.txt")))
|
||||||
;; the first LICENSE file found, if any.
|
;; the first LICENSE file found, if any.
|
||||||
(license_file
|
(license_file
|
||||||
. ,(find (lambda (x) (member x source-files-list))
|
. ,(find (cut member <> source-files-list)
|
||||||
'("LICENSE" "LICENSE.md" "LICENSE.txt")))
|
'("LICENSE" "LICENSE.md" "LICENSE.txt")))
|
||||||
;; the string "ISSUES" if any files exist in ISSUES/
|
;; the string "ISSUES" if any files exist in ISSUES/
|
||||||
(issues_file
|
(issues_file
|
||||||
. ,(and (find (lambda (x) (string-prefix? "ISSUES/" x)) source-files-list) "ISSUES"))
|
. ,(and (find (cut string-prefix? "ISSUES/" <>) source-files-list) "ISSUES"))
|
||||||
(repo2html_version
|
(repo2html_version
|
||||||
. ,(if (equal? version-ident (list->string '(#\$ #\I #\d #\$)))
|
. ,(if (equal? version-ident (list->string '(#\$ #\I #\d #\$)))
|
||||||
""
|
""
|
||||||
|
|
Loading…
Reference in a new issue