[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: Thu, 07 Jul 2016 11:03:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)


Sorry about the slow reply.  Sometimes there's not enough time.

Nicolas Goaziou <address@hidden> writes:

>> +  (unless (or (file-directory-p file) (directory-name-p file))
> What is `directory-name-p'?

Oh, it's new in Emacs-25.  Thanks for pointing that out!

The following is about the index function, which is the most "difficult"

>> +      (let* ((org-inhibit-startup t)
>> +             (visiting (find-buffer-visiting file))
>> +             (buffer (or visiting (find-file-noselect file)))
>> +             (case-fold-search t))
>> +        (with-current-buffer buffer
>> +          ;; protect local variables in open buffers
>> +          (org-export-with-buffer-copy
>> +           (let* ((backends (append (list nil)
>> +                                    (mapcar 'org-export-backend-name
>> +                                            
>> org-export-registered-backends)))
>> +                  (value (cl-loop for backend in backends
>> +                                  when (org-no-properties
>> +                                        (org-element-interpret-data
>> + (plist-get (org-export-get-environment backend)
>> +                                                    prop)))
>> +                                  return it)))
> Return value of `org-element-interpret-data' is never nil so the loop
> always returns the first back-end.
> In any case, this is sub-optimal since common keywords are retrieved for
> each back-end. Also, two back-ends could use the same keyword, with
> different values (e.g., using `parsed' or not).
> One option could be to change the policy about keywords in ox.el and
> move KEYWORDS and SUBTITLE there. Unfortunately, there is still a change
> to miss some cases.
> Another option would be to provide BACKEND to sitemap-function. I think
> it can be backward-compatible if we make it an optional argument.

I obviously agree with your criticism.  It’s not obvious how to do this

If we provide a backend we’d have to move the index preparation to
beginning of each export process as :publishing-function can be a list.
Also, I’m not sure how we’d know about the backend.  Before the exporting
starts, we at most know the names of the functions right?  If one of the
publishing functions is anonymous we don’t even have that.

Perhaps the best way is to move keywords back to ox, though I’d rather opt
for something else.

>> +     ;; Call function to build sitemap based on files and the project-plist.
>> +     (let* ((style (or (plist-get project-plist :sitemap-style) 'tree))
>> +            (fun (intern (format "org-publish-org-sitemap-as-%s" style))))
> Side note : I think this is a bit too smart. It prevents, e.g., from
> grepping for a function name. Maybe 
>   (if (eq style 'something) #'... #'....)
> would be better.

The point is that it should be easy to supply your own functions.  All
sorts of requirements for the index/sitemap could come up, and it is
important to not limit to the tree-style and the flat-style.  I might want
to provide an index ordered by keywords, say.

Perhaps styles should be stores in an alist with elements like


>> address@hidden @code{:sitemap-preamble}
>> address@hidden @code{:sitemap-postamble}
>> address@hidden Preamble and postamble for sitemap.  Useful for inserting
>> +    @code{#+OPTIONS}, footers etc.  See @code{org-publish-sitemap-preamble}
>> +    for details.
> I don't understand the "useful for inserting @code{#+OPTIONS}" part.
> Maybe some examples could be useful. This part of the manual is rather
> terse.

It might be useful to suppress the printing of the title or the author or


I feel emotional landscapes they puzzle me

reply via email to

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