{"id":18081863,"url":"https://github.com/cxxxr/lisp-preprocessor","last_synced_at":"2026-01-30T02:02:36.782Z","repository":{"id":100197424,"uuid":"234125867","full_name":"cxxxr/lisp-preprocessor","owner":"cxxxr","description":"Common lisp embedded template engine","archived":false,"fork":false,"pushed_at":"2020-07-08T04:20:40.000Z","size":19,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T13:52:20.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cxxxr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-01-15T16:41:41.000Z","updated_at":"2025-02-09T08:12:46.000Z","dependencies_parsed_at":"2023-05-12T19:30:56.998Z","dependency_job_id":null,"html_url":"https://github.com/cxxxr/lisp-preprocessor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxxxr%2Flisp-preprocessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxxxr%2Flisp-preprocessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxxxr%2Flisp-preprocessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxxxr%2Flisp-preprocessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cxxxr","download_url":"https://codeload.github.com/cxxxr/lisp-preprocessor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411216,"owners_count":20934651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-31T13:16:45.303Z","updated_at":"2026-01-30T02:02:31.746Z","avatar_url":"https://github.com/cxxxr.png","language":"Common Lisp","readme":"# Lisp Preprocessor\n\nCommon Lisp embedded template engine\n\n## Usage\n\n### input\n```common-lisp\n#include \u003cstdio.h\u003e\n\nint main(void) {\n    #{ :indent\n    (loop :for i :from 0 :below 10\n          :do (format t \"printf(\\\"Loop: %d\\\", ~D);~%\" i)) #}\n    return 0;\n}\n```\n\n### compile\n`(lisp-preprocessor:run-template-into-file #p\"input\" #p\"output\")`\n\n### output\n```common-lisp\n#include \u003cstdio.h\u003e\n\nint main(void) {\n    printf(\"Loop: %d\", 0);\n    printf(\"Loop: %d\", 1);\n    printf(\"Loop: %d\", 2);\n    printf(\"Loop: %d\", 3);\n    printf(\"Loop: %d\", 4);\n    printf(\"Loop: %d\", 5);\n    printf(\"Loop: %d\", 6);\n    printf(\"Loop: %d\", 7);\n    printf(\"Loop: %d\", 8);\n    printf(\"Loop: %d\", 9);\n    return 0;\n}\n```\n\n## API\n\n### (run-template-into-stream compiland stream \u0026rest arguments)\n### (run-template-into-string compiland \u0026rest arguments)\n### (run-template-into-file compiland file \u0026rest arguments)\n```common-lisp\n(let ((compiland (compile-template \"#{ (princ (string-capitalize $arg)) #}\" :arguments '($arg))))\n  (run-template-into-string compiland \"test\"))\n; =\u003e \"Test\"\n```\ncompiland is a string or pathname, or a compiled template function.\n\n### (compile-template text \u0026key template-begin template-begin arguments)\n```common-lisp\n* (compile-template \"foo #{ (princ \\\"bar\\\") #} baz\") ; =\u003e #\u003cFUNCTION (LAMBDA (#:STREAM)) {...}\u003e\n* (run-template-into-stream * *standard-output*)\nfoo bar baz\n\n* (compile-template \"foo {{{ (princ \\\"bar\\\" }}} baz\" :template-begin \"{{{\" :template-end \"}}}\")\n* (run-template-into-stream * *standard-output*)\nfoo bar baz\n\n* (run-template-into-stream (compile-template \"#{ (princ (list ? ??)) #}\" :arguments '(? ??)) *standard-output* \"foo\" \"bar\")\n(foo bar)\n```\n\n## Syntax\n\n```\n#{ template #}\n```\n\n### indent\nKeep indentation of start position\n\n```\n#{ :indent [offset]\n...\n#}\n```\n\n```c\n// input\nint main(void) {\n    #{ :indent\n    (loop :for i :from 0 :below 10\n          :do (format t \"printf(\\\"Loop: %d\\\", ~D);~%\" i)) #}\n    return 0;\n}\n\n// output\nint main(void) {\n    printf(\"Loop: %d\", 0);\n    printf(\"Loop: %d\", 1);\n    printf(\"Loop: %d\", 2);\n    printf(\"Loop: %d\", 3);\n    printf(\"Loop: %d\", 4);\n    printf(\"Loop: %d\", 5);\n    printf(\"Loop: %d\", 6);\n    printf(\"Loop: %d\", 7);\n    printf(\"Loop: %d\", 8);\n    printf(\"Loop: %d\", 9);\n    return 0;\n}\n```\n\n### chop\nChop whitespace before and after the template\n\n```\n#{ :chop #}\n```\n\n```common-lisp\n;;; input\n(defun foo (#{ (format t \"~{~(~A~)~^ ~}\" (loop :for symbol :in '(a b c) :collect symbol)) #}\n            #{ :chop #}\n            #{ (format t \" ~{~(~A~)~^ ~}\" (loop :for symbol :in '(x y z) :collect symbol)) #})\n  (values a b c x y z))\n\n;;; output\n(defun foo (a b c x y z)\n  (values a b c x y z))\n```\n\n### License\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcxxxr%2Flisp-preprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcxxxr%2Flisp-preprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcxxxr%2Flisp-preprocessor/lists"}