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>
|
||||
</nav>
|
||||
<hr />
|
||||
{% if source_file %}
|
||||
<p id="file-path">{{ source_file }}</p>
|
||||
{% endif %}
|
||||
{{ content|safe }}
|
||||
<hr />
|
||||
<footer>
|
||||
|
|
37
main.scm
37
main.scm
|
@ -174,25 +174,24 @@
|
|||
`(pre ,(git-file->string source-file)))
|
||||
(define (binary)
|
||||
'(p "(Binary file)"))
|
||||
`((p (@ id "file-path") ,source-file)
|
||||
,(case (string->symbol extension)
|
||||
((.md .markdown)
|
||||
(handle-exceptions exn
|
||||
(begin
|
||||
(format (current-error-port) "Error parsing ~a\n" source-file)
|
||||
`((p (b "There was an error parsing this file as Markdown."))
|
||||
,(plaintext)))
|
||||
(markdown->sxml (git-file->string source-file))))
|
||||
((.jpg .jpeg .png .gif .webp .webm .apng .avif .svgz .ico)
|
||||
(image-link))
|
||||
((.svg)
|
||||
(list (image-link) (plaintext)))
|
||||
((.gz .pack .idx)
|
||||
(binary))
|
||||
(else
|
||||
(if (git-file-is-text? source-file)
|
||||
(plaintext)
|
||||
(binary))))))
|
||||
(case (string->symbol extension)
|
||||
((.md .markdown)
|
||||
(handle-exceptions exn
|
||||
(begin
|
||||
(format (current-error-port) "Error parsing ~a\n" source-file)
|
||||
`((p (b "There was an error parsing this file as Markdown."))
|
||||
,(plaintext)))
|
||||
(markdown->sxml (git-file->string source-file))))
|
||||
((.jpg .jpeg .png .gif .webp .webm .apng .avif .svgz .ico)
|
||||
(image-link))
|
||||
((.svg)
|
||||
(list (image-link) (plaintext)))
|
||||
((.gz .pack .idx)
|
||||
(binary))
|
||||
(else
|
||||
(if (git-file-is-text? source-file)
|
||||
(plaintext)
|
||||
(binary))))
|
||||
|
||||
(define (filelist->sxml source-files-list relative-root)
|
||||
`((h1 "Files")
|
||||
|
|
Loading…
Reference in a new issue