Last active
December 25, 2015 01:09
Revisions
-
Brit Butler revised this gist
Oct 8, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,3 +36,7 @@ (if (pathname-type result) result (make-pathname :type "html" :defaults result)))) ;;; You can also do insane things like... ;;; make a DSL for writing Finite State Machines using the Method Dispatch system ;;; If you're crazy: https://gist.github.com/sshirokov/2698150 -
kingcons created this gist
Oct 8, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ (defpackage :lisp-oo (:use :cl)) (in-package :lisp-oo) (defclass content () ((tags :initform nil :initarg :tags :accessor content-tags) (slug :initform nil :initarg :slug :accessor content-slug) (date :initform nil :initarg :date :accessor content-date) (text :initform nil :initarg :text :accessor content-text))) (defun construct (content-type args) "Create an instance of CONTENT-TYPE with the given ARGS." (apply 'make-instance content-type args)) (defgeneric publish (content-type) (:documentation "Write pages to disk for all content of the given CONTENT-TYPE.")) (defgeneric render (object &key &allow-other-keys) (:documentation "Render the given OBJECT to HTML.")) (defgeneric render-content (text format) (:documentation "Compile TEXT from the given FORMAT to HTML for display.") (:method (text (format (eql :html))) text) (:method (text (format (eql :md))) (let ((3bmd-code-blocks:*code-blocks* t)) (with-output-to-string (str) (3bmd:parse-string-and-print-to-stream text str))))) (defgeneric page-url (object) (:documentation "The url to the object, without the domain.")) (defmethod page-url :around ((object t)) (let ((result (call-next-method))) (if (pathname-type result) result (make-pathname :type "html" :defaults result))))