all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thibault Marin <thibault.marin@gmx.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org, Rasmus Pank Roulund <rasmus@gmx.us>
Subject: Re: Use headings in sitemap
Date: Sun, 30 Oct 2016 22:38:23 -0500	[thread overview]
Message-ID: <87fund5gsw.fsf@dell-desktop.WORKGROUP> (raw)
In-Reply-To: <87d1ihhh49.fsf@nicolasgoaziou.fr>

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

  reply	other threads:[~2016-10-31  3:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29  4:09 Use headings in sitemap Thibault Marin
2016-10-11 16:34 ` Nicolas Goaziou
2016-10-12  4:52   ` Thibault Marin
2016-10-12  9:12   ` Rasmus Pank Roulund
2016-10-12 10:20     ` Nicolas Goaziou
2016-10-30 17:38       ` Nicolas Goaziou
2016-10-31  3:38         ` Thibault Marin [this message]
2016-10-31  8:04           ` Nicolas Goaziou
2016-10-31 12:57             ` Thibault Marin
2016-10-31 15:21               ` Nicolas Goaziou
2016-11-01  2:36                 ` Thibault Marin
2016-11-02 10:08                   ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fund5gsw.fsf@dell-desktop.WORKGROUP \
    --to=thibault.marin@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.