From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thibault Marin Subject: Re: Use headings in sitemap Date: Sun, 30 Oct 2016 22:38:23 -0500 Message-ID: <87fund5gsw.fsf@dell-desktop.WORKGROUP> References: <87fuojl53s.fsf@dell-desktop.WORKGROUP> <87y41uq1yo.fsf@nicolasgoaziou.fr> <87bmyqq6az.fsf@gmx.us> <878tttq368.fsf@nicolasgoaziou.fr> <87d1ihhh49.fsf@nicolasgoaziou.fr> Reply-To: thibault.marin@gmx.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c13Qf-0001we-V0 for emacs-orgmode@gnu.org; Sun, 30 Oct 2016 23:38:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c13Qb-00025U-2Y for emacs-orgmode@gnu.org; Sun, 30 Oct 2016 23:38:33 -0400 Received: from mout.gmx.net ([212.227.17.22]:57683) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c13Qa-00024r-PI for emacs-orgmode@gnu.org; Sun, 30 Oct 2016 23:38:29 -0400 In-reply-to: <87d1ihhh49.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org, Rasmus Pank Roulund Nicolas Goaziou writes: > I pushed an implementation of that idea in wip-sitemap branch, if anyone > wants to test it. Thanks! > For example, setting :sitemap-function property to > > (lambda (title list) > (concat "#+TITLE: " title "\n\n" > (org-list-to-subtree list))) > > mostly achieves what the OP wants. I don't have the `directory-name-p' function (I am still on emacs 24), so I made a simplistic one: (string= file (file-name-sans-extension file)), it seems to be sufficient for my test-case. I don't know if not being on 25 will cause other issues. I also had to add a call to `expand-file-name' around the definition of the `root' variable (in `org-publish-sitemap') to account for the fact that my :base-directory is defined with "~/" instead of "/home/...". Another thing I had to modify was the :exclude pattern which was mis-formed earlier ("setup.org\\|website.org\\|rss.org" changed to "setup\\.org\\|website\\.org\\|rss\\.org"). The earlier version of the pattern results in an empty file list but was not a problem on the older version of the sitemap tools. Anyway, I have now fixed my setup. > Also, setting :sitemap-format-entry > to > > (lambda (entry root style) > (if (directory-name-p entry) > (file-name-nondirectory (directory-file-name entry)) > (format > "[[file:%s][%s]]%s" > (file-relative-name entry root) > (org-publish-find-title entry) > (let ((subtitle > (org-element-interpret-data > (org-publish-find-property entry :subtitle 'latex)))) > (if (equal subtitle "") "" (format " (%s)" subtitle)))))) This is perfect for me, thanks. I wanted to display the date along with the title for all the pages in the posts heading so I used the following (I should be able to filter the folder name better than this, this was just to test things out). (lambda (entry root style) (if (directory-name-p entry) (file-name-nondirectory (directory-file-name entry)) (format "[[file:%s][%s%s]]" (file-relative-name entry root) (let ((date (org-element-interpret-data (org-publish-find-property entry :date)))) (if (or (equal date "") (not (string-match "posts/" (file-relative-name entry root)))) "" (format "(%s) " (replace-regexp-in-string "[<>]" "" date)))) (org-publish-find-title entry)))) > Feedback weclome. >From my limited use, this perfectly fits my needs. The only thing I have not fully tested yet is the sorting mechanism, I'll try that soon. Thanks, thibault