https://github.com/jpcima/cl-why
(X)HTML generation macros, fork of CL-WHO
https://github.com/jpcima/cl-why
common-lisp dsl html html-template web
Last synced: 4 months ago
JSON representation
(X)HTML generation macros, fork of CL-WHO
- Host: GitHub
- URL: https://github.com/jpcima/cl-why
- Owner: jpcima
- License: bsd-3-clause
- Created: 2017-04-09T15:19:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-12T15:20:18.000Z (about 9 years ago)
- Last Synced: 2026-01-26T13:55:09.853Z (4 months ago)
- Topics: common-lisp, dsl, html, html-template, web
- Language: Common Lisp
- Size: 34.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# cl-why
(X)HTML generation macros, fork of CL-WHO
## Reason behind CL-WHY
This project is intended as an improvement over CL-WHO, a Common Lisp library for HTML generation.
I develop this fork because while a tree DSL is an elegant way to construct HTML documents, I disagree with some ideas of the original specification.
One particular problem with CL-WHO is about *escaping*: values are not escaped unless it is explicitly demanded.
On the contrary, the values should be written escaped by default and raw by exception; it reduces the probability of making mistakes and helps to ensure creating well-formed documents.
## Installing
Download CL-WHY in a path recognized by Quicklisp and execute the following command.
(ql:quickload '#:cl-why)
## Differences
The usage of CL-WHY is largely similar to CL-WHO whose documentation is located [here](http://weitz.de/cl-who/).
Instead of a complete documentation I make a list of differences between these two libraries.
- Automatic escaping of attribute values and string nodes
(with-html-output-to-string (s) (:a :href "a\"test" "foo<>bar"))
CL-WHY: "foo<>bar"
CL-WHO: "foo<>bar"
- Possibility to include raw strings, to use carefully
(with-html-output-to-string (s) (:div (raw "Hello")))
CL-WHY: "
Hello"
- Accepted non-null values other than string at child node context (CL-WHO silently ignores these)
(with-html-output-to-string (s) (:body 123 "abc" 456))
CL-WHY: "123abc456"
CL-WHO: "abc"
- Removed macros *str* and *fmt*, found no longer useful or redundant
- Conditional compilation is updated for recent Common Lisp implementations
- *ELEMENT-TYPE* support added in SBCL and ECL