nyxt icon indicating copy to clipboard operation
nyxt copied to clipboard

Use `spinneret:with-html` instead of `:raw` tag

Open aartaka opened this issue 9 months ago • 0 comments

Using :raw implies opaque HTML strings passed to it, which is never good. Especially compared to Spinneret-native nested with-html approach: we can call HTML-printing functions inside the top-level HTML generating functions, so that HTML is recursively nested way. Example for describe-function:

(def ... describe-function ()
  (flet ((method-desc (method)
           (spinneret:with-html
             ...)))
    (spinneret:with-html-string
      ...
      (:nsection
       :title "Methods"
       (dolist (method (mopu:generic-function-methods
                        (symbol-function input)))
         (method-desc method)))
      ...)))

Instead of

(def ... describe-function ()
  (flet ((method-desc (method)
           (spinneret:with-html-STRING
             ...)))
    (spinneret:with-html-string
      ...
      (:nsection
       :title "Methods"
       (dolist (method (mopu:generic-function-methods
                        (symbol-function input)))
         (:RAW (method-desc method))))
      ...)))

No need for :raw and opaque string-returning

CC @hgluka: we've discussed this problem today

aartaka avatar Sep 22 '23 13:09 aartaka