[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Use headings in sitemap
From: |
Thibault Marin |
Subject: |
Re: [O] Use headings in sitemap |
Date: |
Sun, 30 Oct 2016 22:38:23 -0500 |
User-agent: |
mu4e 0.9.16; emacs 24.5.1 |
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
- Re: [O] Use headings in sitemap, Nicolas Goaziou, 2016/10/11
- Re: [O] Use headings in sitemap, Thibault Marin, 2016/10/12
- Re: [O] Use headings in sitemap, Rasmus Pank Roulund, 2016/10/12
- Re: [O] Use headings in sitemap, Nicolas Goaziou, 2016/10/12
- Re: [O] Use headings in sitemap, Nicolas Goaziou, 2016/10/30
- Re: [O] Use headings in sitemap,
Thibault Marin <=
- Re: [O] Use headings in sitemap, Nicolas Goaziou, 2016/10/31
- Re: [O] Use headings in sitemap, Thibault Marin, 2016/10/31
- Re: [O] Use headings in sitemap, Nicolas Goaziou, 2016/10/31
- Re: [O] Use headings in sitemap, Thibault Marin, 2016/10/31