less dynamism

dev-nonsettable
Matthew Butterick 5 years ago
parent a18766f53e
commit c394d27332

@ -48,16 +48,28 @@
'NAME 'NAME
(λ () DEFAULT-NAME))))))])) (λ () DEFAULT-NAME))))))]))
(define-syntax (define-nonsettable stx)
(syntax-case stx ()
[(_ NAME DEFAULT-VALUE)
(with-syntax ([DEFAULT-NAME (format-id stx "default-~a" #'NAME)]
[NAME-THUNKED (format-id stx "~a" #'NAME)]
[NAME-FAIL-THUNKED (format-id stx "fail-thunk-~a" #'NAME)] )
#'(begin
(provide (prefix-out setup: NAME-THUNKED) DEFAULT-NAME)
(define DEFAULT-NAME DEFAULT-VALUE)
;; can take a dir argument that sets start point for (get-path-to-override) search.
(define (NAME-THUNKED [dir #false]) DEFAULT-VALUE)))]))
(define-settable cache-watchlist null) (define-settable cache-watchlist null)
(define-settable envvar-watchlist null) (define-settable envvar-watchlist null)
(define-settable preproc-source-ext 'pp) (define-nonsettable preproc-source-ext 'pp)
(define-settable markup-source-ext 'pm) (define-nonsettable markup-source-ext 'pm)
(define-settable markdown-source-ext 'pmd) (define-nonsettable markdown-source-ext 'pmd)
(define-settable null-source-ext 'p) (define-nonsettable null-source-ext 'p)
(define-settable pagetree-source-ext 'ptree) (define-nonsettable pagetree-source-ext 'ptree)
(define-settable template-source-ext 'pt) (define-nonsettable template-source-ext 'pt)
(define-settable scribble-source-ext 'scrbl) (define-nonsettable scribble-source-ext 'scrbl)
;; these are deliberately not settable because they're just internal signalers, no effect on external interface ;; these are deliberately not settable because they're just internal signalers, no effect on external interface
(define+provide default-mode-auto 'auto) (define+provide default-mode-auto 'auto)
@ -67,9 +79,9 @@
(define+provide default-mode-pagetree 'ptree) (define+provide default-mode-pagetree 'ptree)
(define+provide default-mode-template 'template) (define+provide default-mode-template 'template)
(define-settable old-cache-names '("pollen.cache" "pollen-cache")) (define-nonsettable old-cache-names '("pollen.cache" "pollen-cache"))
(define-settable cache-dir-name "compiled") (define-nonsettable cache-dir-name "compiled")
(define-settable cache-subdir-name "pollen") (define-nonsettable cache-subdir-name "pollen")
(define+provide default-cache-names (list* (cache-dir-name) (old-cache-names))) (define+provide default-cache-names (list* (cache-dir-name) (old-cache-names)))
(define-settable decodable-extensions (list (markup-source-ext) (pagetree-source-ext))) (define-settable decodable-extensions (list (markup-source-ext) (pagetree-source-ext)))
@ -81,14 +93,14 @@
(define-settable command-char #\◊) (define-settable command-char #\◊)
(define-settable template-command-char #\∂) (define-settable template-command-char #\∂)
(define-settable template-prefix "template") (define-nonsettable template-prefix "template")
(define-settable fallback-template-prefix "fallback") (define-nonsettable fallback-template-prefix "fallback")
(define-settable template-meta-key "template") (define-nonsettable template-meta-key "template")
(define-settable main-export 'doc) ; don't forget to change fallback template too (define-nonsettable main-export 'doc) ; don't forget to change fallback template too
(define-settable meta-export 'metas) (define-nonsettable meta-export 'metas)
(define-settable meta-tag-name 'meta) (define-nonsettable meta-tag-name 'meta)
(define-settable define-meta-name 'define-meta) (define-nonsettable define-meta-name 'define-meta)
;; tags from https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements ;; tags from https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
(define-settable block-tags (cons (main-root-node) '(address article aside blockquote body canvas dd div dl fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hgroup hr li main nav noscript ol output p pre section table tfoot ul video))) (define-settable block-tags (cons (main-root-node) '(address article aside blockquote body canvas dd div dl fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hgroup hr li main nav noscript ol output p pre section table tfoot ul video)))

Loading…
Cancel
Save