Overview
| Comment: | Use metas? |
|---|---|
| Timelines: | family | ancestors | cache-faster |
| Files: | files | file ages | folders |
| SHA3-256: |
aaa8d600828bcf39d54066d40d4330a4 |
| User & Date: | joel on 2021-02-14 03:14:32 |
| Other Links: | branch diff | manifest | tags |
Context
|
2021-02-14
| ||
| 03:14 | Use metas? Leaf check-in: aaa8d600 user: joel tags: cache-faster | |
|
2020-07-03
| ||
| 20:59 | A start on improving build times check-in: 4b2c827f user: joel tags: cache-faster | |
Changes
Modified dust.rkt from [cb0db902] to [831cdf23].
| ︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
racket/system
racket/string)
;; Provides common helper functions used throughout the project
(provide maybe-meta ; Select from (current-metas) or default value ("") if not available
maybe-attr ; Return an attribute’s value or a default ("") if not available
here-output-path
here-source-path
here-id
listing-context
current-series-noun ; Retrieve noun-singular from current 'series meta, or #f
current-series-title ; Retrieve title of series in current 'series meta, or #f
current-series-pagenode
| > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
racket/system
racket/string)
;; Provides common helper functions used throughout the project
(provide maybe-meta ; Select from (current-metas) or default value ("") if not available
maybe-attr ; Return an attribute’s value or a default ("") if not available
set-meta!
here-output-path
here-source-path
here-id
listing-context
current-series-noun ; Retrieve noun-singular from current 'series meta, or #f
current-series-title ; Retrieve title of series in current 'series meta, or #f
current-series-pagenode
|
| ︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
(define (default-title body-txprs)
(format "“~a…”" (first-words body-txprs 5)))
(define (maybe-meta m [missing ""])
(cond [(current-metas) (or (select-from-metas m (current-metas)) missing)]
[else missing]))
;; Return the current source path, relative to (current-project-root)
(define (here-source-path)
(match (current-metas)
[(? hash? m)
(define-values (_ rel-path-parts)
(drop-common-prefix (explode-path (current-project-root))
(explode-path (string->path (hash-ref m 'here-path)))))
| > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
(define (default-title body-txprs)
(format "“~a…”" (first-words body-txprs 5)))
(define (maybe-meta m [missing ""])
(cond [(current-metas) (or (select-from-metas m (current-metas)) missing)]
[else missing]))
(define (set-meta! key v)
(define cur-metas (current-metas))
(and cur-metas
(current-metas (hash-set! cur-metas key v))))
;; Return the current source path, relative to (current-project-root)
(define (here-source-path)
(match (current-metas)
[(? hash? m)
(define-values (_ rel-path-parts)
(drop-common-prefix (explode-path (current-project-root))
(explode-path (string->path (hash-ref m 'here-path)))))
|
| ︙ | ︙ |
Modified tags-html.rkt from [88b1006b] to [6a584dcf].
| ︙ | ︙ | |||
108 109 110 111 112 113 114 |
(define second-pass
(decode-elements first-pass
#:block-txexpr-proc detect-newthoughts
#:inline-txexpr-proc decode-link-urls
#:exclude-tags '(script style pre code)))
`(body ,@second-pass))
| | > > > | > > > | > > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
(define second-pass
(decode-elements first-pass
#:block-txexpr-proc detect-newthoughts
#:inline-txexpr-proc decode-link-urls
#:exclude-tags '(script style pre code)))
`(body ,@second-pass))
(define (html-title . elements)
(set-meta! 'title elements)
`(title ,@elements))
(define (html-excerpt . elements)
(set-meta! 'excerpt elements)
"")
(define (html-excerpt* . elements)
(set-meta! 'excerpt elements)
`(@ ,@elements))
(define (html-blockcode attrs elems)
(define file (or (assoc 'filename attrs) ""))
(define codeblock `(pre [[class "code"]] (code ,@elems)))
(cond [(string>? file "") `(@ (div [[class "listing-filename"]] 128196 " " ,file) ,codeblock)]
[else codeblock]))
|
| ︙ | ︙ |