[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [ox-publish, patch] More flexible sitemaps

From: Rasmus
Subject: Re: [O] [ox-publish, patch] More flexible sitemaps
Date: Fri, 27 May 2016 18:41:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)


Thanks for the comments.

Nicolas Goaziou <address@hidden> writes:

>> (org-publish-find-subtitle): New function.
>> (org-publish-org-sitemap-as-tree): New function.
>> (org-publish--find-property): Find arbirary property.
>> (org-publish-project-alist): Document changes.
>> * doc/org.texi (Sitemap): Update documentation.
> All in all, I think this deserves to be split into 3 patches: one for
> the preamble-postamble feature, another one for implementing
> `org-publish--find-property' and associated refactoring, and the latter
> for the sitemap itself.

This was by far the hardest part...

>> +(autoload 'message-flatten-list "message")
>> +(autoload 'dired-tree-lessp "dired-aux")
> I hope we can avoid these. In particular, why are you using
> `dired-tree-lessp' instead of `org-publish-compare-directory-files'?

AFAIK, org-publish-compare-directory-files can’t be used on its own.  It
requires variables to be bound around it,
e.g. org-publish-sitemap-ignore-case.  See org-publish-get-base-files.
(I don’t know why the project plist isn’t being passed around.)

Anyway, I’m not using neither of these files anymore.

Aside: the way ox-publish order files is not super, IMO, as it takes
directory into account even if one use a flat list and chronological
ordering.  That’s a problem for another day, though.

>> +(defun org-publish--tree-assoc (key tree)
>> +(defun org-pubish--order-files-by-dir-tree (files)
> I don't understand why you need the 2 functions above. You are working
> with plain lists, not nested ones. Besides, once the file name are
> standardized, isn't tree order equivalent to lexicographic one?


>> +(defun org-publish-find-subtitle (file &optional reset)
>> +  "Find the title of FILE in project."
>> +  (org-publish--find-property file :subtitle reset))
> I don't think this would work. :subtitle is not defined in default
> export properties, it is back-end specific. `org-export-get-environment'
> without any argument, doesn't catch these. You need to somehow provide
> it the back-end.

You are right.  The "problem" is that the sitemap is done in a before the
backend is known.  So we can’t do (org-export-get-environment BACKEND).

OTOH, only allowing ox.el keywords is too limiting IMO.  E.g. a blog
sitemap wouldn’t be able to include keywords, though a desirable format
for each entry is

    #+INCLUDE: "file.org::lead"

But KEYWORDS is specific to ox-html...

A couple of workarounds:

1. Guess the backend(s) from the name of :publishing-function.  This is
   not very robust...
2. Find the keyword by search in the file, thus sidestepping
   org-export-get-environment.  It is is not without problems.  E.g. if my
   file contains this, I’d probably only key1.
      #+Keywords: key1
      #+Keywords: key2
3. Go through backend for org-export-get-environment until something is
   Found.  I do this now.


This is the kind of tedious nonsense up with which I will not put

Attachment: 0001-ox-publish-Tiny-refactor.patch
Description: Text Data

Attachment: 0002-ox-publish-Get-property-from-file.patch
Description: Text Data

Attachment: 0003-ox-publish-Optionally-add-dirs-to-project-files.patch
Description: Text Data

Attachment: 0004-ox-publish-More-flexible-sitemap-formatting.patch
Description: Text Data

Attachment: 0005-ox-publish-Sitemap-preamble-and-postamble.patch
Description: Text Data

Attachment: 0006-org.texi-Document-ox-publish-sitemap-changes.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]