@@ 14,36 14,40 @@
`(tag em ,@body))
(def gensite (base (o publish-drafts nil))
- (with (start-time (msec)
- config (get-config (string base "/conf.arc"))
- published-folder (string base "/published/")
- ;; the folder holding all published site entries
- output-folder (string base "/output/")
- draft-folder (string base "/draft/")
- pregenerated-folder (string base "/pregenerated/")
- ;; a folder that holds static files.
- ;; It's copied to output-folder recursively.
+ (withs (start-time (msec)
+ config (get-config (string base "/conf.arc"))
+ published-folder (string base "/published/")
+ ;; the folder holding all published site entries
+ published-files (keep file-exists
+ (map [string published-folder "/" _]
+ (dir published-folder)))
- frontpage-folder (string base "/frontpage/")
- ;; a folder holding extra files for the frontpage.
- ;; each of them should be a serialized arc obj
- ;; with keys date, frontpage, and navbar.
- ;; The date value is used for sorting,
- ;; and the frontpage value is printed on the frontpage.
+ output-folder (string base "/output/")
+ draft-folder (string base "/draft/")
+ pregenerated-folder (string base "/pregenerated/")
+ ;; a folder that holds static files.
+ ;; It's copied to output-folder recursively.
- codegen-folder (string base "/codegen/"))
+ frontpage-folder (string base "/frontpage/")
+ ;; a folder holding extra files for the frontpage.
+ ;; each of them should be a serialized arc obj
+ ;; with keys date, frontpage, and navbar.
+ ;; The date value is used for sorting,
+ ;; and the frontpage value is printed on the frontpage.
+
+ codegen-folder (string base "/codegen/"))
(unless (dir-exists published-folder)
(err (string "Where's your published folder? I'm expecting it to be at " published-folder)))
(when (dir-exists output-folder)
(system (string "rm -r " output-folder)))
(ensure-dir output-folder)
(msince start-time "Getting divs-and-scripts: ")
- (with (navbar-div (get-navbar-div published-folder config)
- analytics-script (get-analytics-script base)
- src-filepaths (get-src-filepaths published-folder)
- frontpage-filepaths (get-frontpage-filepaths frontpage-folder)
- codegen-filepaths (get-codegen-filepaths codegen-folder)
- tag-map (get-tags published-folder))
+ (withs (navbar-div (get-navbar-div published-folder config)
+ analytics-script (get-analytics-script base)
+ src-filepaths (get-src-filepaths published-folder)
+ frontpage-filepaths (get-frontpage-filepaths frontpage-folder)
+ codegen-filepaths (get-codegen-filepaths codegen-folder)
+ tag-map (get-tags (+ published-files frontpage-filepaths)))
(msince start-time "Copying pregenerated folder: ")
(when (dir-exists pregenerated-folder)
(copy-pregenerated-folder pregenerated-folder output-folder analytics-script))
@@ 585,15 589,13 @@ pregenerated-folder
(and page-options!navbar
page-options!frontpage))
-(def get-tags (published-folder)
- "Get the tags for PUBLISHED-FOLDER.
+(def get-tags (files)
+ "Get the tags for FILES, a set of fully-qualified pathnames.
+
+Each FILE should have a set of options at its start.
This is returned as a object mapping tag names to the list of options for pages with that tag."
(withs (tag-map (obj)
- published-files (dir published-folder)
- files (keep file-exists
- (map [string published-folder "/" _]
- published-files))
all-options (map get-options files))
(each page-options all-options
(when (page-is-public page-options)