~brettgilio/org-webring

ccb47099b0f2e3956d0e771797a099e846dca834 — Alexandru-Sergiu Marton a month ago e386847
Fix the <nil/> problem.

We used the `when' macro in a few places in the code fed to
xmlgen. Since `when' is just an `if' that has `nil' as it's "else"
branch, whenever the `when' condition was false, xmlgen inserted a
<nil/> element into the generated code.

This is fixed by making the whens return lists that are
spliced. Splicing `nil' seems to be really doing nothing (there's
nothing to extract out of an empty list), and that's what we want.
1 files changed, 17 insertions(+), 19 deletions(-)

M org-webring.el
M org-webring.el => org-webring.el +17 -19
@@ 367,9 367,9 @@ was introduced in Emacs 27) isn't available."
                          (if (org-webring--item-pinned-p item)
                              "-pinned"
                            nil))
          ,(when (org-webring--item-pinned-p item)
             `(div :class "org-webring-article-pinned-symbol"
                   ,(print org-webring-pin-symbol)))
          ,@(when (org-webring--item-pinned-p item)
              `((div :class "org-webring-article-pinned-symbol"
                     ,org-webring-pin-symbol)))
	  (h4 :class "org-webring-article-title"
              (a :href ,(org-webring--get-link item)
		 :target "_blank"


@@ 430,8 430,8 @@ was introduced in Emacs 27) isn't available."
	      articles))))
    (xmlgen
     `(section :class "org-webring"
	       ,(when org-webring-display-header
		  `(h4 ,(print org-webring-header)))
	       ,@(when org-webring-display-header
		   `((h4 ,(print org-webring-header))))
	       (section :class "org-webring-articles" ,@articles)
	       (p :class "org-webring-attribution"
		  ,@(when org-webring-display-generation-time


@@ 441,14 441,13 @@ was introduced in Emacs 27) isn't available."
				org-webring-timestamp-generate-format))
		       `(br)))
		  ,@(when org-webring-display-attribution
		      (list
		       (print "Generated with ")
		       `(a :href ,org-webring-attribution-link
		      `(,(print "Generated with ")
			(a :href ,org-webring-attribution-link
			   :target "_blank"
			   ,org-webring-attribution-name)
		       (when org-webring-display-version
			 (print (concat " -- v"
					org-webring-version))))))))))
			,@(when org-webring-display-version
			    (list (print (concat " -- v"
						 org-webring-version)))))))))))

(defun org-webring-generate-planet ()
  "Generate the entire planet with syndicates list and return it as HTML."


@@ 462,8 461,8 @@ was introduced in Emacs 27) isn't available."
         (articles (mapcar #'org-webring--article-instance most-recent)))
    (xmlgen
     `(section :class "org-webring-planet"
	       ,(when org-webring-planet-display-description
		  `(h4 (center ,(print org-webring-planet-description))))
	       ,@(when org-webring-planet-display-description
		   `((h4 (center ,(print org-webring-planet-description)))))
               (p :class "org-webring-attribution"
		  ,@(when org-webring-display-generation-time
		      (list


@@ 472,14 471,13 @@ was introduced in Emacs 27) isn't available."
			        org-webring-timestamp-generate-format))
		       `(br)))
		  ,@(when org-webring-display-attribution
		      (list
		       (print "Generated with ")
		       `(a :href ,org-webring-attribution-link
		      `(,(print "Generated with ")
			(a :href ,org-webring-attribution-link
			   :target "_blank"
			   ,org-webring-attribution-name)
		       (when org-webring-display-version
		         (print (concat " -- v"
				        org-webring-version)))))
			,@(when org-webring-display-version
		            (list (print (concat " -- v"
						 org-webring-version))))))
                  (hr))
               (div :class "row"
                    ,(let* ((org-webring-items-per-source 1)