From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2IEcFjFAXF8bewAA0tVLHw (envelope-from ) for ; Sat, 12 Sep 2020 03:27:45 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id AJs/EDFAXF+ZTgAAB5/wlQ (envelope-from ) for ; Sat, 12 Sep 2020 03:27:45 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9DD519404C7 for ; Sat, 12 Sep 2020 03:27:44 +0000 (UTC) Received: from localhost ([::1]:44652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGwCV-0004i7-Gr for larch@yhetil.org; Fri, 11 Sep 2020 23:27:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGwC8-0004gY-Bf for emacs-orgmode@gnu.org; Fri, 11 Sep 2020 23:27:20 -0400 Received: from memebeam.org ([80.68.89.71]:36730 helo=jvb.vm.bytemark.co.uk) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGwC6-0002C9-Ca for emacs-orgmode@gnu.org; Fri, 11 Sep 2020 23:27:20 -0400 Received: from [192.168.1.27] (pppoe-209-99-203-201.greenmountainaccess.net [::ffff:209.99.203.201]) (AUTH: LOGIN acarrico@memebeam.org, TLS: TLS1.3, 128bits, ECDHE_RSA_AES_128_GCM_SHA256) by jvb.vm.bytemark.co.uk with ESMTPSA id 0000000000190647.5F5C3FF1.000029B2; Fri, 11 Sep 2020 23:26:41 -0400 Subject: [PATCH] Include missing files when sitemap style is tree To: emacs-orgmode@gnu.org From: Anthony Carrico X-Forwarded-Message-Id: Message-ID: <393d0ddf-894a-6183-c1fd-d8ab23a2163a@memebeam.org> Date: Fri, 11 Sep 2020 23:26:33 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=80.68.89.71; envelope-from=acarrico@memebeam.org; helo=jvb.vm.bytemark.co.uk X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/11 23:26:42 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: SHaMcQURarxL * ox-publish.el (org-publish-sitemap): Include files that have an ancestor below base-directory with no published files and sitemap style is tree. This entire patch is released to the public domain by its author, Anthony Carrico. TINYCHANGE --- lisp/ox-publish.el | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 7bb2fed6e..314b48ffc 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -747,6 +747,20 @@ return a string. Return value is a list as returned by (funcall subtree-to-list root))) (_ (user-error "Unknown site-map style: `%s'" style))))) +(defun org-publish-dir-name-parent (dir-name) + (file-name-as-directory (expand-file-name (concat dir-name "..")))) + +(defun org-publish-dir-name-and-parents (dir-name root-dir-name) + (pcase dir-name + ("" nil) + ((or "./" "/" (pred (string= root-dir-name))) (list dir-name)) + (_ (cons dir-name (org-publish-dir-name-and-parents + (org-publish-dir-name-parent dir-name) root-dir-name))))) + +(defun org-publish-file-name-parents (file root) + (org-publish-dir-name-and-parents (file-name-directory file) + (file-name-as-directory root))) + (defun org-publish-sitemap (project &optional sitemap-filename) "Create a sitemap of pages in set defined by PROJECT. Optionally set the filename of the sitemap with SITEMAP-FILENAME. @@ -819,8 +833,11 @@ Default for SITEMAP-FILENAME is `sitemap.org'." ;; Add directories, if applicable. (unless (and (eq style 'list) (eq sort-folders 'ignore)) (setq files - (nconc (remove root (org-uniquify - (mapcar #'file-name-directory files))) + (nconc (remove + root + (org-uniquify + (mapcan (lambda (f) (org-publish-file-name-parents f root)) + files))) files))) ;; Eventually sort all entries. (when (or sort-files (not (memq sort-folders 'ignore))) -- 2.25.4