diff options
author | riton <riton@riton.home> | 2025-03-24 00:23:07 +0300 |
---|---|---|
committer | riton <riton@riton.home> | 2025-03-24 00:23:07 +0300 |
commit | 052753e4a3c00929c10702f46cb4404bd11b63d5 (patch) | |
tree | 02bd8daa797a2ed69e41443b14686e716e7106cd /ana.lisp | |
parent | 411505245c696f7e1e7c80ee2392639165b6b39f (diff) |
markdown dosyasını htmle dönüştürüp şablona gömme
Diffstat (limited to 'ana.lisp')
-rw-r--r-- | ana.lisp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ana.lisp b/ana.lisp new file mode 100644 index 0000000..ac4c9ca --- /dev/null +++ b/ana.lisp @@ -0,0 +1,29 @@ +(in-package :html-jen) + +(defun başlık-bul (node) + (loop :for çocuk :in (children node) + :do (when (eq :h1 (tag çocuk)) + (return (value çocuk))))) + +(defun şablon-yap (node) + (ebeveyn-node! :html + (list (ebeveyn-node! :head + (list (çocuk-node! :title (başlık-bul node)) + ;;; geçici hack çünkü /> ile biten tagleri düzgün basamıyorum + " <link href=\"index.css\" rel=\"stylesheet\"> +")) + (ebeveyn-node! :body + (list node))))) + +(defun şablonlu-yazdır (node &optional (stream *standard-output*)) + (format stream "<!DOCTYPE html>~%~%") + (node->html (şablon-yap node) stream)) + +(defun markdown->html (kaynak hedef) + (let ((okur (okur! kaynak))) + (let ((root (markdown-ayrıştır okur)) + (*print-case* :downcase)) + (with-open-file (dış hedef :direction :output + :if-does-not-exist :create + :if-exists :supersede) + (şablonlu-yazdır root dış))))) |