Closed mfiano closed 7 years ago
I'm not on a machine where I can test this out, but a compile/load-time setting (ej when changed, (define-all-tags)
must be re-evaluated) would be the following
(defvar *close-or-tags-p* nil
"If t, spinneret will print and end tag for all tags, including when the closing tag may be omitted.")
;; in functions.lisp define-tag
;; replace
(close
(when needs-close
(format nil "</~(~A~)>" tag))))
;; with
(close
(when (or needs-close *close-all-tags-p*)
(format nil "</~(~A~)>" tag))))
This is a reasonable request, and I plan to accommodate it, but I would prefer not to introduce compile-time configuration. I need to think about how to make pretty-printing more flexible without making it too inefficient.
It is now possible to get this simpler style of pretty printing by binding the *html-style*
variable to :tree
.
I would like the ability to turn off the exclusion of end tags, for those that are optional. That is, I would like to always close tags such as
</p>
if I choose to with a special variable or whatnot.Likewise, I would like the same optional behavior for inline tags. Instead of always being inline, I want them to always behave as on a new line indented like other tags, if I choose to do so.
I tried to make a patch, but I'm not sure the best way to do it without significant changes to the functionality of the code, considering tag functions are generated and interned at load time.