Overview
| Comment: | Don't recompute article ids every time | 
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk | 
| Files: | files | file ages | folders | 
| SHA3-256: | 49e661b8c201642c070dc3bce73f275e | 
| User & Date: | joel on 2020-02-26 01:15:05 | 
| Other Links: | manifest | tags | 
Context
| 2020-02-29 | ||
| 15:51 | Make relativize script play nice with tidy-introduced line breaks check-in: fcaf9eac user: joel tags: trunk | |
| 2020-02-26 | ||
| 01:15 | Don't recompute article ids every time check-in: 49e661b8 user: joel tags: trunk | |
| 2020-02-24 | ||
| 07:35 | Variadic make-tag-predicate check-in: 3ed11073 user: joel tags: trunk | |
Changes
Modified dust.rkt from [e986dd0a] to [bed6133b].
| ︙ | ︙ | |||
| 86 87 88 89 90 91 92 93 94 95 96 | 
    [else (or (select-from-metas 'noun-singular series-pnode) "")]))
(define (series-metas-title)
  (define series-pnode (metas-series-pagenode)) 
  (case series-pnode
    ['|| ""] ; no series specified
    [else (or (select-from-metas 'title series-pnode) "")]))
;; Generates a short ID for the current article
(define (here-id [suffix #f])
  (define here-hash
 | > > > > > | > > > | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | 
    [else (or (select-from-metas 'noun-singular series-pnode) "")]))
(define (series-metas-title)
  (define series-pnode (metas-series-pagenode)) 
  (case series-pnode
    ['|| ""] ; no series specified
    [else (or (select-from-metas 'title series-pnode) "")]))
(define article-ids (make-hash))
;; Generates a short ID for the current article
(define (here-id [suffix #f])
  (define maybe-hash (hash-ref article-ids (here-output-path) #f))
  (define here-hash
    (cond
      [(not maybe-hash)
       (let ([h (substring (bytes->hex-string (sha1-bytes (path->bytes (here-output-path)))) 0 8)])
         (hash-set! article-ids (here-output-path) h)
         h)]
      [else maybe-hash]))
  (cond [(list? suffix) (apply string-append here-hash suffix)]
        [(string? suffix) (string-append here-hash suffix)]
        [else here-hash]))
;; “Touches” the last-modified date on the current article’s series, if there is one
(define (invalidate-series)
 | 
| ︙ | ︙ | |||
| 233 234 235 236 237 238 239 | 
                
;; Convert, e.g., "* thoroughly recanted" into (values "*" "thoroughly recanted")
(define (disposition-values str)
  (cond [(string=? "" str) (values "" "")]
        [else (let ([splut (string-split str)])
                (values (car splut) (string-join (cdr splut))))]))
 | | < | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | 
                
;; Convert, e.g., "* thoroughly recanted" into (values "*" "thoroughly recanted")
(define (disposition-values str)
  (cond [(string=? "" str) (values "" "")]
        [else (let ([splut (string-split str)])
                (values (car splut) (string-join (cdr splut))))]))
;; The format of a note’s ID is “HTML-driven” (used as an anchor link)
(define (build-note-id txpr)
  (string-append (maybe-attr 'date (get-attrs txpr))
                 "_"
                 (uri-encode (maybe-attr 'author (get-attrs txpr) default-authorname))))
;; Extract the last disposition (if any), and the ID of the disposing note, out of a list of notes
(define (notes->last-disposition-values txprs)
 | 
| ︙ | ︙ |