◊(Local Yarn Code "series-list.rkt at [d5b9dd58]")

File series-list.rkt artifact ebdb6c3d part of check-in d5b9dd58


#lang racket/base

; SPDX-License-Identifier: BlueOak-1.0.0
; This file is licensed under the Blue Oak Model License 1.0.0.

;; Provides fast metadata for series.
;; TO MAKE A NEW SERIES:
;;   1. Create series/my-key.poly.pm
;;   2. Add an entry for my-key to series-list below
;;   3. Use ◊define-meta[series "my-key"] in articles to add them to the series.
;;   4. If ptree-ordered is #t, also create series/my-key.ptree

(require racket/list)
(struct series (key title noun-plural noun-singular ptree-ordered?))

(define series-list
  (make-immutable-hash
   (list
   ;; ------- DEFINE SERIES HERE -----------
            ; Key               Title              plural noun    singular noun phrase
   (+series "marquee-fiction"   "Marquee Fiction" "Inventions"    "an invention"         #f)
   (+series "local-yarn"        "Local Yarn Site Notes" "Project notes" "a project note" #f)
   )))

(define (series-grouped-list)
  (group-by series-noun-plural (hash-values series-list)))

;; Quick macro to save a little typing
(define-syntax-rule (+series key title plural singular ptree)
  (cons key (series key title plural singular ptree)))

(provide (struct-out series)
         series-list
         series-grouped-list)