ah finally fixed the image prefix for index.html thing
This commit is contained in:
parent
e6d77be6a5
commit
12790c87e4
1 changed files with 11 additions and 5 deletions
16
main.scm
16
main.scm
|
@ -146,13 +146,19 @@
|
|||
inner
|
||||
(alist-update-in '(@ href) (cons adjust-relative (append linkurl '(".html"))) inner equal?))))
|
||||
|
||||
;; TODO FIXME for some reason, lowdown renders links differently than images:
|
||||
;; (markdown->sxml "[x](x)") => ((p (a (@ (href "x")) "x")))
|
||||
;; (markdown->sxml "![x](x)") => ((p (img (@ (src ("x")) (alt "x")))))
|
||||
|
||||
(define (adjust-relative-src adjust-relative inner)
|
||||
(let* ((srcurl (alist-ref-in '(@ src) inner equal?))
|
||||
(srcurl-startswith (cute string-prefix? <> (car srcurl))))
|
||||
(let* ((srcurl (caar (alist-ref-in '(@ src) inner equal?)))
|
||||
(srcurl-startswith (cute string-prefix? <> srcurl)))
|
||||
(if
|
||||
(any srcurl-startswith '("/" "http://" "https://"))
|
||||
(or (not adjust-relative)
|
||||
(not srcurl)
|
||||
(any srcurl-startswith '("/" "http://" "https://")))
|
||||
inner
|
||||
(alist-update-in '(@ src) (list adjust-relative srcurl) inner equal?))))
|
||||
(alist-update-in '(@ src) `((,(string-append adjust-relative srcurl))) inner equal?))))
|
||||
|
||||
(define (sxml-html-rules adjust-relative)
|
||||
`(;; assign all headings an id so you can link to them
|
||||
|
@ -213,7 +219,7 @@
|
|||
(define-values (_ _ basename extension _)
|
||||
(pathparts source-file))
|
||||
(define (image-link)
|
||||
`(p (img (@ src ,basename ,extension))))
|
||||
`(p (img (@ (src (,(string-append basename extension)))))))
|
||||
(define (plaintext)
|
||||
`(pre ,(git-file->string source-file)))
|
||||
(define (binary)
|
||||
|
|
Loading…
Reference in a new issue