◊(Local Yarn Code "Check-in [bd48c56a]")

Overview
Comment:Allow here-output-path even when no metas are available
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bd48c56a0502cf339932d7f33da50b2a9271ca2b9c618e5e929083e00ee72ff6
User & Date: joel on 2019-07-05 03:27:59
Other Links: manifest | tags
Context
2019-07-10
01:29
Make parallel processing in Pollen setup explicit check-in: 7d4de0ec user: joel tags: trunk
2019-07-05
03:27
Allow here-output-path even when no metas are available check-in: bd48c56a user: joel tags: trunk
2019-07-04
18:19
Add close-head? to page header function check-in: 5fc9abc0 user: joel tags: trunk
Changes

Modified code-docs/dust.scrbl from [aa4ce70b] to [d5eab31d].

58
59
60
61
62
63
64
65
66


67
68
69
70
71
72


73
74
75
76
77
78
79
58
59
60
61
62
63
64


65
66
67
68
69
70


71
72
73
74
75
76
77
78
79







-
-
+
+




-
-
+
+







document contained in @racket[articles-folder], and @racket[series-pagetree] contains a pagenode for
every Pollen document in @racket[series-folder]. The pagenodes themselves point to the rendered
@tt{.html} targets of the source documents.

@defproc[(here-output-path) path?]

Returns the path to the current output file, relative to @racket[current-project-root]. If no metas
are available, raises an error. This is like what you can get from the @tt{here} variable that Pollen
provides, except it is available outside templates.
are available, returns @racket[(string->path ".")]. This is like what you can get from the @tt{here}
variable that Pollen provides, except it is available outside templates.

@defproc[(here-id [suffix (or/c (listof string?) string? #f) #f]) string?]

Returns the 8-character prefix of the SHA1 hash of the current document’s output path. If no metas
are available, raises an error. If @racket[_suffix] evaluates to a string or a list of strings, they
are appended verbatim to the end of the hash.
are available, the hash of @racket[(string->path ".")] is used. If @racket[_suffix] evaluates to
a string or a list of strings, they are appended verbatim to the end of the hash.

This ID is used when creating URL fragment links within an article, such as for footnotes and index
entries. As long as the web version of the article is not moved to a new URL, the ID will remain the
same, which ensures deep links using the ID don’t break. The ID also ensures each article’s internal
links will be unique, so that links do not collide when multiple articles are being shown on
a single HTML page.

Modified dust.rkt from [30ceaf46] to [4209ef85].

61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75







-
+







;; except this is an actual path, not a string.
(define (here-output-path)
  (cond [(current-metas)
         (define-values (_ rel-path-parts)
           (drop-common-prefix (explode-path (current-project-root))
                               (explode-path (string->path (select-from-metas 'here-path (current-metas))))))
         (->output-path (apply build-path rel-path-parts))]
        [else (error "No metas are available")]))
        [else (string->path ".")]))

;; Checks current-metas for a 'series meta and returns the pagenode of that series,
;; or '|| if no series is specified.
(define (series-pagenode)
  (define maybe-series (or (select-from-metas 'series (current-metas)) ""))
  (cond
    [(non-empty-string? maybe-series)