move the decision about where to render the filename into the template
This commit is contained in:
parent
e2487098c5
commit
f1c42b4a6a
2 changed files with 21 additions and 19 deletions
|
@ -42,6 +42,9 @@
|
||||||
<a href="{{ relative_root }}contributors.html">contributors</a>
|
<a href="{{ relative_root }}contributors.html">contributors</a>
|
||||||
</nav>
|
</nav>
|
||||||
<hr />
|
<hr />
|
||||||
|
{% if source_file %}
|
||||||
|
<p id="file-path">{{ source_file }}</p>
|
||||||
|
{% endif %}
|
||||||
{{ content|safe }}
|
{{ content|safe }}
|
||||||
<hr />
|
<hr />
|
||||||
<footer>
|
<footer>
|
||||||
|
|
37
main.scm
37
main.scm
|
@ -174,25 +174,24 @@
|
||||||
`(pre ,(git-file->string source-file)))
|
`(pre ,(git-file->string source-file)))
|
||||||
(define (binary)
|
(define (binary)
|
||||||
'(p "(Binary file)"))
|
'(p "(Binary file)"))
|
||||||
`((p (@ id "file-path") ,source-file)
|
(case (string->symbol extension)
|
||||||
,(case (string->symbol extension)
|
((.md .markdown)
|
||||||
((.md .markdown)
|
(handle-exceptions exn
|
||||||
(handle-exceptions exn
|
(begin
|
||||||
(begin
|
(format (current-error-port) "Error parsing ~a\n" source-file)
|
||||||
(format (current-error-port) "Error parsing ~a\n" source-file)
|
`((p (b "There was an error parsing this file as Markdown."))
|
||||||
`((p (b "There was an error parsing this file as Markdown."))
|
,(plaintext)))
|
||||||
,(plaintext)))
|
(markdown->sxml (git-file->string source-file))))
|
||||||
(markdown->sxml (git-file->string source-file))))
|
((.jpg .jpeg .png .gif .webp .webm .apng .avif .svgz .ico)
|
||||||
((.jpg .jpeg .png .gif .webp .webm .apng .avif .svgz .ico)
|
(image-link))
|
||||||
(image-link))
|
((.svg)
|
||||||
((.svg)
|
(list (image-link) (plaintext)))
|
||||||
(list (image-link) (plaintext)))
|
((.gz .pack .idx)
|
||||||
((.gz .pack .idx)
|
(binary))
|
||||||
(binary))
|
(else
|
||||||
(else
|
(if (git-file-is-text? source-file)
|
||||||
(if (git-file-is-text? source-file)
|
(plaintext)
|
||||||
(plaintext)
|
(binary))))
|
||||||
(binary))))))
|
|
||||||
|
|
||||||
(define (filelist->sxml source-files-list relative-root)
|
(define (filelist->sxml source-files-list relative-root)
|
||||||
`((h1 "Files")
|
`((h1 "Files")
|
||||||
|
|
Loading…
Reference in a new issue