emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Thibault Marin <thibault.marin@gmx.com>
Cc: org mode <emacs-orgmode@gnu.org>, Rasmus <rasmus@gmx.us>
Subject: Re: Use headings in sitemap
Date: Tue, 11 Oct 2016 18:34:23 +0200	[thread overview]
Message-ID: <87y41uq1yo.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87fuojl53s.fsf@dell-desktop.WORKGROUP> (Thibault Marin's message of "Wed, 28 Sep 2016 23:09:11 -0500")

Hello,

Thibault Marin <thibault.marin@gmx.com> writes:

> I would like to generate a sitemap for a published website and use it to extract
> the last few entries in a specific folder to put on the main page.
>
> The site structure looks like:
> .
> ├── index.org
> ├── posts
> │   ├── A.org
> │   ├── B.org
> │   └── C.org
> ├── misc
> │   ├── page.org
> │   └── other-page.org
> └── sitemap.org
>
> In index.org, I would have:
>
> #+begin_src org
> #+INCLUDE: sitemap.org::*posts :lines "-10" :only-contents t
> #+end_src
>
> to include links to the 10 most recent pages in =posts= (I use
> :sitemap-sort-files anti-chronologically in the project setup).  If I am not
> missing anything, this requires the sitemap.org file to have a =posts= heading,
> but the `org-publish-org-sitemap' function only produces a list of pages.
>
> If there is no better way to get this to work, I would like to propose a patch
> to `org-publish-org-sitemap' to produce headings in the sitemap file when a new
> parameter is passed and non-nil.  The attached patch is my first attempt at it,
> it works for my tests.
>
> I would be interested to hear people's opinion on this:
> - Is there a better way to achieve what I want?
> - Is the proposed patch acceptable?  Any comments would be appreciated.

This reminds me of a patch Rasmus (Cc'ed) is working on (thread starting
at: <http://permalink.gmane.org/gmane.emacs.orgmode/107219>).

I'd like to propose here a slightly different, hopefully simpler
approach so as to get flexibility without entering keyword hell.

The first thing to note is that :sitemap-function is, IMO, unusable,
because it puts too much work on the hands of the user. Indeed, they
have to generate the title of the sitemap page, get the list of files in
the project, walk that list, handle sorting according to style...

I suggest to let :sitemap-function operate on the lists of files
included in the sitemap (i.e., the list of files in the project),
already ordered, and formatted according to
`org-publish-sitemap-file-entry-format'.

The list would be provided in the same format as the return value from
`org-list-to-lisp', so that, e.g., `org-list-to-subtree' can be directly
called on it.

Also, I suggest to make `org-publish-sitemap-file-entry-format'
a function instead of a string, so as to get more power, i.e., to not
limit ourselves to the list of placeholders allowed in the format
string. In particular, we could provide a public function
org-publish-get-keyword (file keyword &optional backend), much like what
Rasmus does in his patchset, but with a back-end so as to get the value
of any export keyword. Also, this would make
`org-publish-sitemap-dir-entry-format' unnecessary.

Eventually, we could run a hook at the end of `org-publish-org-sitemap',
which would now always be called, in order to give the opportunity to
modify the sitemap as a whole (e.g., the title).

In a nutshell, ISTM that it would solve both your request and the
difficulties encountered by Rasmus in changes.

WDYT?


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-10-11 16:34 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 [this message]
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
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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87y41uq1yo.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    --cc=thibault.marin@gmx.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).