Skip to content

Commit

Permalink
feat: generate now produces a proper slug if given a normal title
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Simpson committed May 14, 2020
1 parent 44729e7 commit 0e97df1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ ecl:
clean:
rm cycle
.PHONY: cycle

install:
mv cycle /usr/local/bin/cycle
.PHONY: install
3 changes: 2 additions & 1 deletion cycle.asd
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
:description "A opinionated static site builder."
:author "Adam Simpson <[email protected]>"
:license "GNU GPLv3"
:version "0.2.1"
:version "0.2.6"
:serial t
:depends-on (
:local-time
:cl-json
:cl-mustache
:cl-ppcre
:3bmd
:3bmd-ext-code-blocks
:unix-opts)
Expand Down
9 changes: 6 additions & 3 deletions cycle.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,13 @@

(defun generate-post (title)
"Take TITLE and create the necessary JSON and MD files for it."
(let ((date (shell "date +%Y-%m-%dT%R:%S%:z"))
(let* ((date (shell "date +%Y-%m-%dT%R:%S%:z"))
(slug (cl-ppcre:regex-replace-all ","
(cl-ppcre:regex-replace-all " " (string-downcase title) "-")
""))
(id (get-id))
(json-file (concat "./posts/" title ".json"))
(md-file (concat "./posts/" title ".md")))
(json-file (concat "./posts/" slug ".json"))
(md-file (concat "./posts/" slug ".md")))
(write-file (json:encode-json-to-string `(("id" . ,id)
("published" . ,date)
("title" . ,title)
Expand Down

0 comments on commit 0e97df1

Please sign in to comment.