From 052753e4a3c00929c10702f46cb4404bd11b63d5 Mon Sep 17 00:00:00 2001 From: riton Date: Mon, 24 Mar 2025 00:23:07 +0300 Subject: =?UTF-8?q?markdown=20dosyas=C4=B1n=C4=B1=20htmle=20d=C3=B6n=C3=BC?= =?UTF-8?q?=C5=9Ft=C3=BCr=C3=BCp=20=C5=9Fablona=20g=C3=B6mme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ana.lisp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ana.lisp (limited to 'ana.lisp') 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 + " +")) + (ebeveyn-node! :body + (list node))))) + +(defun şablonlu-yazdır (node &optional (stream *standard-output*)) + (format stream "~%~%") + (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ış))))) -- cgit v1.2.3