Created
August 10, 2012 10:26
-
-
Save ignacy/3313246 to your computer and use it in GitHub Desktop.
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 characters
| (defun html (x) | |
| "Return valid HTML code constructed from passed list" | |
| (if (not (listp x)) | |
| x | |
| (let ((tag (car x)) | |
| (body (cdr x))) | |
| (if (and (listp (car body)) (string= "attributes" (first (car body)))) | |
| (concat "<" tag " " (car (cdr (car body))) ">" | |
| (apply 'concat (mapcar 'html (cdr body))) | |
| "</" tag ">") | |
| (concat "<" tag ">" | |
| (apply 'concat (mapcar 'html body)) | |
| "</" tag ">"))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment