Changed absolute image paths back to relative paths, since everything else is using a relative path

This works, because when you click a link to view a file source, the
link takes you into the directory where the image is, because
directories are recursively made in the web server directory to mimic
the structure of the git repository, and so files with the same name
don't conflict, because they'll be in a different directory.
This commit is contained in:
m455 2022-12-07 22:31:58 -05:00
parent 4bc524d02c
commit 07e73e4083

View file

@ -88,7 +88,7 @@ string-block
(call-with-input-pipe read-lines)
(string-intersperse "\n")))
(define (display-source-html repository-name source-file) ;; src/main.scm
(define (display-source-html source-file) ;; src/main.scm
(format #t "<p id=\"file-path\">~a</p>" source-file)
(case (string->symbol (or (pathname-extension source-file) "no-extension"))
((md markdown)
@ -103,9 +103,9 @@ string-block
(display "</pre>"))
(markdown->html (git-file->string source-file))))
((jpg jpeg png gif webp webm apng avif svgz ico)
(format #t "<p><img src=\"/~a/~a\" /></p>" repository-name source-file))
(format #t "<p><img src=\"~a\" /></p>" (pathname-strip-directory repository-name) source-file))
((svg)
(format #t "<p><img src=\"/~a/~a\" /></p>" repository-name source-file)
(format #t "<p><img src=\"~a\" /></p>" (pathname-strip-directory repository-name) source-file)
(display "<pre>")
(display-escaped-html (git-file->string source-file))
(display "</pre>"))
@ -160,7 +160,7 @@ string-block
(lambda (source-file)
(write-with-template
(string-append source-file ".html")
(lambda () (display-source-html repository-name source-file)))
(lambda () (display-source-html source-file)))
(case (string->symbol (or (pathname-extension source-file) ""))
((jpg jpeg png gif webp webm svg apng avif svgz ico)
(system (format "git show HEAD:~a > ~a"