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))))
|
||||
`(,t .
|
||||
,(if (and adjust-relative
|
||||
(not (string-prefix? "#" linkurl))
|
||||
(not (string-prefix? "/" linkurl))
|
||||
(not (string-prefix? "https://" linkurl))
|
||||
(not (string-prefix? "http://" linkurl))
|
||||
(not (string-prefix? "mailto:" linkurl))
|
||||
(not (string-prefix? "https://" linkurl)))
|
||||
|
||||
(not (any
|
||||
(cute string-prefix? <> linkurl)
|
||||
'("#" "/" "https://" "http://" "mailto:" "https://"))))
|
||||
(alist-update '@
|
||||
(alist-update 'href `(,adjust-relative ,linkurl) (alist-ref '@ i))
|
||||
i)
|
||||
|
@ -138,7 +134,7 @@
|
|||
"-\t-\t"
|
||||
(call-with-input-pipe
|
||||
(string-append "git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 --numstat HEAD -- " source-file)
|
||||
(lambda (port) (read-line port 4))))))
|
||||
(cute read-line <> 4)))))
|
||||
|
||||
(define (git-repository->paths-list)
|
||||
(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 "/")))
|
||||
;; the first README file found, if any.
|
||||
(readme_file
|
||||
. ,(find (lambda (x) (member x source-files-list))
|
||||
. ,(find (cut member <> source-files-list)
|
||||
'("README" "README.md" "README.txt")))
|
||||
;; the first LICENSE file found, if any.
|
||||
(license_file
|
||||
. ,(find (lambda (x) (member x source-files-list))
|
||||
. ,(find (cut member <> source-files-list)
|
||||
'("LICENSE" "LICENSE.md" "LICENSE.txt")))
|
||||
;; the string "ISSUES" if any files exist in ISSUES/
|
||||
(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
|
||||
. ,(if (equal? version-ident (list->string '(#\$ #\I #\d #\$)))
|
||||
""
|
||||
|
|
Loading…
Reference in a new issue