From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Rasmus Pank Roulund <rasmus@gmx.us>
Cc: thibault.marin@gmx.com, emacs-orgmode@gnu.org
Subject: Re: Use headings in sitemap
Date: Sun, 30 Oct 2016 18:38:30 +0100 [thread overview]
Message-ID: <87d1ihhh49.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <878tttq368.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Wed, 12 Oct 2016 12:20:31 +0200")
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Rasmus Pank Roulund <rasmus@gmx.us> writes:
>
>> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> It’s not quite that complicated in my patch/WIP. You specify an ordering
>> function. E.g. the plain list is:
>>
>> (defun org-publish-org-sitemap-as-list (files project-plist)
>> "Insert FILES as simple list separated by newlines.
>> PROJECT-PLIST holds the project information."
>> (mapconcat
>> (lambda (file) (org-publish-format-file-entry
>> org-publish-sitemap-file-entry-format
>> file project-plist))
>> files "\n"))
>>
>> If you don’t have the full flexibility of a function I guess someone will
>> always run into trouble eventually...
>
> I think one mistake here is to conflate style and formatting. By doing
> so, defining a new style implies that one has to handle sorting,
> directories (or lack thereof)... and also Org syntax.
>
> I suggest to keep style as a mean to control how the file names are
> provided, and separate it from the formatting process, handled
> by :sitemap-function and :sitemap-format-entry or some such.
>
> We might, however, by this definition, merge sorting and style together
> (e.g., tree-date-ascending list-name-descending).
>
>>> 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'.
>>
>> Isn’t that’s what my patch does?
>
> More or less, but my proposal is slightly different. E.g., I suggest
> a different data type for the arguments.
>
> OTOH, your patch does other things orthogonal to my proposal (e.g.
> preamble and postambles for sitemaps...).
>
>> I like that, but AFAIK the backend is not known at the time the sitemap is
>> generated. And it might not be deducible from the publishing
>> function.
>
> You might have misread my proposal.
>
> I'm suggesting to leave it up to the user. Whenever they define a new
> sitemap function and need to implement a formatting function, they can
> provide the name of the back-end they want to use. This information is
> known to the user.
>
> Conversely, we do not provide any ready-to-use keyword (so, no format
> string with placeholders) because, as you write, we cannot predict the
> back-end with certainty. Instead, we merely implement a generic getter
> function (which you mostly implemented in your patch set).
I pushed an implementation of that idea in wip-sitemap branch, if anyone
wants to test it.
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. 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))))))
will add a subtitle to the entry, when available, upon publishing to
LaTeX.
Feedback weclome.
Regards,
next prev parent reply other threads:[~2016-10-30 17: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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d1ihhh49.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 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.