1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#lang scribble/manual
@; SPDX-License-Identifier: BlueOak-1.0.0
@; This file is licensed under the Blue Oak Model License 1.0.0.
@(require "scribble-helpers.rkt"
scribble/example)
@(require (for-label "../pollen.rkt"
"../dust.rkt"
racket/base
racket/contract
txexpr
sugar/coerce
pollen/tag
pollen/setup
pollen/pagetree
pollen/core))
@(define dust-eval (make-base-eval))
@(dust-eval '(require "dust.rkt" txexpr))
@title{@filepath{dust.rkt}}
@defmodule["dust.rkt" #:packages ()]
This is where I put constants and helper functions that are needed pretty much everywhere in the
project. In a simpler project these would go in @seclink["pollen-rkt"]{@filepath{pollen.rkt}} but
here I have other modules sitting “behind” that one in the @tt{require} chain.
|
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#lang scribble/manual
@; SPDX-License-Identifier: BlueOak-1.0.0
@; This file is licensed under the Blue Oak Model License 1.0.0.
@(require "scribble-helpers.rkt"
scribble/example)
@(require (for-label "../pollen.rkt"
"../dust.rkt"
"../cache.rkt"
racket/base
racket/contract
txexpr
sugar/coerce
pollen/tag
pollen/setup
pollen/pagetree
pollen/core))
@(define dust-eval (make-base-eval))
@(dust-eval '(require "dust.rkt" txexpr))
@title{Dust}
@defmodule["dust.rkt" #:packages ()]
This is where I put constants and helper functions that are needed pretty much everywhere in the
project. In a simpler project these would go in @seclink["pollen-rkt"]{@filepath{pollen.rkt}} but
here I have other modules sitting “behind” that one in the @tt{require} chain.
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
(first-words txs-punc-and-split-elems 5)
(first-words txs-dashes 5)
(first-words txs-parens-commas 5)
(first-words txs-short 5)
]
@section{Article parsers and helpers}
@defproc[(default-title [body-txprs (listof txexpr?)]) string?]
Given a list of tagged X-expressions (the elements of an article’s doc, e.g.), returns a string
containing a suitable title for the document. (Uses @racket[first-words].)
Titles are not required for articles, but there are contexts where you need something that
serves as a title if one is not present, and that’s what this function supplies.
@examples[#:eval dust-eval
(define doc
'(root (p "If I had been astonished at first catching a glimpse of so outlandish an "
"individual as Queequeg circulating among the polite society of a civilized "
"town, that astonishment soon departed upon taking my first daylight "
"stroll through the streets of New Bedford…")))
|
>
>
>
>
>
>
>
>
|
|
|
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
(first-words txs-punc-and-split-elems 5)
(first-words txs-dashes 5)
(first-words txs-parens-commas 5)
(first-words txs-short 5)
]
@section{Article parsers and helpers}
@defparam[listing-context ctxt (or/c 'blog 'feed 'print "") #:value ""]
A parameter specifying the current context where any listings of articles would appear. Its purpose
is to allow articles to exclude themselves from certain special collections (e.g., the blog, the RSS
feed, print editions). Any article whose @code{conceal} meta matches the current context will not be
included in any listings returned by the listing functions in
@seclink["cache-rkt"]{@filepath{cache.rkt}}.
@defproc[(default-title [body-txprs (listof txexpr?)]) string?]
Given a list of tagged X-expressions (the elements of an article’s doc, e.g.), returns a string
containing a suitable title for the document. (Uses @racket[first-words].)
Titles are not required for articles, but there are contexts where you need something that serves as
a title if one is not present, and that’s what this function supplies.
@examples[#:eval dust-eval
(define doc
'(root (p "If I had been astonished at first catching a glimpse of so outlandish an "
"individual as Queequeg circulating among the polite society of a civilized "
"town, that astonishment soon departed upon taking my first daylight "
"stroll through the streets of New Bedford…")))
|