From a7eb272b0282b02d90033f816068b56ade5da991 Mon Sep 17 00:00:00 2001 From: sorrel Date: Sun, 25 Feb 2024 20:15:24 -0500 Subject: [PATCH] change resource id schema to type/headline --- publish.rkt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/publish.rkt b/publish.rkt index 21d4779..e2b0776 100644 --- a/publish.rkt +++ b/publish.rkt @@ -88,10 +88,8 @@ ".scm")) (error "'root resource requires headline"))) (define (make-res-file-handle x r id) - (if (< 0 id) - (path->string (path-add-extension (build-path (if x "publish-test/source" "source") r (~a id)) - ".scm")) - (error "~a resource requires r-id" r))) + (path->string (path-add-extension (build-path (if x "publish-test/source" "source") r (~a id)) + ".scm"))) (if (equal? r-type "root") (make-root-file-handle x-test l-headline) (make-res-file-handle x-test r-type r-id))) @@ -144,8 +142,8 @@ [resources (make-weak-hash)] [posts (map (lambda (lookup/id) (if (hash-has-key? post-lookup lookup/id) - (append (list lookup/id) (rest (hash-ref post-lookup lookup/id))) - (append (list lookup/id) (rest (get-post-data lookup/id resources post-lookup x))))) + (hash-ref post-lookup lookup/id) + (get-post-data lookup/id resources post-lookup x))) (filter non-empty-string? (rest tag-table-row)))] [make-index (read (open-input-file "source/make-index.scm"))] [new-index ((eval make-index ns) (~a "tagged/" tag) posts)] @@ -225,9 +223,7 @@ (build-path "data" r)) #".csv")))) - (define res-id (if (equal? r "root") - (string-replace l " " "-") - (length res-table))) + (define res-id (string-replace l " " "-")) ;; before anything else, open output file ;; doing this means that if a file exists of the intended (define out