From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Use headings in sitemap Date: Sun, 30 Oct 2016 18:38:30 +0100 Message-ID: <87d1ihhh49.fsf@nicolasgoaziou.fr> References: <87fuojl53s.fsf@dell-desktop.WORKGROUP> <87y41uq1yo.fsf@nicolasgoaziou.fr> <87bmyqq6az.fsf@gmx.us> <878tttq368.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0u42-0001Gl-Vg for emacs-orgmode@gnu.org; Sun, 30 Oct 2016 13:38:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0u3z-0005Sy-NS for emacs-orgmode@gnu.org; Sun, 30 Oct 2016 13:38:34 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:36854) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c0u3z-0005Sq-Gg for emacs-orgmode@gnu.org; Sun, 30 Oct 2016 13:38:31 -0400 In-Reply-To: <878tttq368.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Wed, 12 Oct 2016 12:20:31 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Rasmus Pank Roulund Cc: thibault.marin@gmx.com, emacs-orgmode@gnu.org Nicolas Goaziou writes: > Hello, > > Rasmus Pank Roulund writes: > >> Nicolas Goaziou writes: > >> It=E2=80=99s 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=E2=80=99t have the full flexibility of a function I guess som= eone 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=E2=80=99t that=E2=80=99s 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.=20 > > 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,