✍ Divulgar ciência

Pedido ao http://divulgarciencia.com

Depois de muito protelar, por alguns meses, a formatação do RSS com as categorias correctas, a coisa acabou por ser feita! A nova função em Emacs lisp ficou assim:

(defun muse-index-as-string-sort-by-date-xml (&optional exclude-private exclude-current)
  (let ((files (sort (mapcar (lambda (pair)
                              (list
                               (car pair)
                               (cdr pair)
                               (nth 5 (file-attributes (cdr pair)))))
                            (muse-project-file-alist))
                    (function
                     (lambda (l r)
                       (not (muse-time-less-p
                             (nth 2 l)(nth 2 r))))))))
    (when (and exclude-current (muse-page-name))
      (setq files (delete (assoc (muse-page-name) files) files)))
    (with-temp-buffer
      (insert "<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'>\n")
      (insert "<channel>\n")
      (insert "<atom:link href='http://www.diale.org/diale.xml' rel='self' type='application/rss+xml' />\n")
      (insert "<lastBuildDate>"(format-time-string "%a, %d %b %Y %T"
               (nth 5 (file-attributes "index"))) " GMT</lastBuildDate>\n")
      (insert "<title>" (muse-extract-file-directive "index" "title")"</title>\n")
      (insert "<description>" (muse-extract-file-directive "index" "desc")"</description>\n")
      (insert "<link>http://www.diale.org</link>\n")
      (insert "<managingEditor>"(muse-extract-file-directive "index" "author")"</managingEditor>\n")
      (insert "<generator>muse.el</generator>\n")
      (while files
        (unless (and exclude-private
                     (muse-project-private-p (cdar files)))
          (insert "<item>\n")
          (insert "<guid>"(concat "http://www.diale.org/" (caar files) ".html") "</guid>\n")
          (insert "<link>"(concat "http://www.diale.org/" (caar files) ".html") "</link>\n")
          (insert "<pubDate>"(format-time-string "%a, %d %b %Y %T"
                   (nth 5 (file-attributes (caar files))))" GMT</pubDate>\n")
          (insert "<title>"(muse-extract-file-directive (caar files) "title"))
          (insert "</title>\n")
          (insert "<description>"(muse-extract-file-directive (caar files) "desc")"</description>\n")

          (setq keywords-categ (split-string (muse-extract-file-directive (caar files) "keywords") ", "))
          (while keywords-categ
                  (insert "<category>" (car keywords-categ) "</category>\n")
                  (setq keywords-categ (cdr keywords-categ)))
          (insert "</item>\n"))
        (setq files (cdr files)))
      (insert "</channel>\n</rss>")
      (buffer-string))))

Já me esquecia... para que este blog possa ficar indexado no http://divulgarciencia.com

Palavras chave/keywords: ciência, w3, blog, emacs, lisp

Última actualização/Last updated: 2014-11-13 [00:02]


1999-2014 (ç) Tiago Charters de Azevedo

São permitidas cópias textuais parciais/integrais em qualquer meio com/sem alterações desde que se mantenha este aviso.

Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.