Open equwal opened 5 years ago
This isn't really important for me as one can associate the file extensions with the necessary mode. If you were to pursue this further you could take a look at this function in src/content.lisp
:
(defun parse-metadata (stream)
"Given a STREAM, parse metadata from it or signal an appropriate condition."
(flet ((get-next-line (input)
(string-trim '(#\Space #\Return #\Newline #\Tab) (read-line input nil))))
(unless (string= (get-next-line stream) (separator *config*))
(error "The file, ~a, lacks the expected header: ~a" (file-namestring stream) (separator *config*)))
(loop for line = (get-next-line stream)
until (string= line (separator *config*))
appending (parse-initarg line))))
One feature of the .post and .page files is that Emacs (or another editor) does not know what mode to use. This can be solved in Emacs with
magic-mode-alist
, which is how I am doing it in coleslaw mode. A simpler way is to put a line like-*-mode-goes-here-*-
on the first line of the file. Such a thing would obsolete half the code in coleslaw mode.