8.7 Low-Level API
8.7.1 Collecting and Building
| (require camp/build) | package: camp-lib |
The camp/build module provides the two-pass build system for Camp sites.
procedure
(collect site) → site-info?
site : site?
procedure
(collect/call-with-page site slug proc) → any
site : site? slug : string? proc : (-> document? context? any)
This is useful for rendering or processing a single page with full site context without performing a complete build!. The slug is matched case-insensitively. Raises an error if no page with the given slug exists.
(collect/call-with-page my-site "my-post" my-render-function)
procedure
site : site? info : site-info?
struct
(struct site-info (pages term-index page-index taxonomy-index) #:extra-constructor-name make-site-info #:transparent) pages : (listof page?) term-index : hash? page-index : hash? taxonomy-index : hash?
parameter
(current-site-info) → (or/c site-info? #f)
(current-site-info info) → void? info : (or/c site-info? #f)
struct
(struct page (source-path output-path doc slug collection-name) #:extra-constructor-name make-page #:transparent) source-path : path? output-path : path? doc : any/c slug : string? collection-name : string?
8.7.2 Development Server
| (require camp/serve) | package: camp-lib |
The camp/serve module provides a development server for local testing.
procedure
(start-server output-folder [ #:port port #:log-format log-format]) → (-> void?) output-folder : path-string? port : exact-nonnegative-integer? = 8000 log-format : (or/c 'modern 'apache) = 'modern
The log-format parameter controls request logging: 'modern produces a clean HH:MM:SS METHOD PATH STATUS format suitable for colorized terminal output, while 'apache produces traditional Apache combined log format.
Note: This function only starts a static server. File watching and automatic rebuilds are provided by the raco camp serve command, which uses this function internally.
8.7.3 Logging
| (require camp/log) | package: camp-lib |
The camp/log module provides structured logging for Camp operations.
value
syntax
(log-camp-fatal string-expr arg ...)
syntax
(log-camp-error string-expr arg ...)
syntax
(log-camp-warning string-expr arg ...)
syntax
(log-camp-info string-expr arg ...)
syntax
(log-camp-debug string-expr arg ...)