branch: externals/hugoista
commit 22b543c0cb9c74ede7e762a16d44173c08c906ab
Author: c-alpha <[email protected]>
Commit: c-alpha <[email protected]>
Fix Issue #3
---
NEWS | 39 +++++++++++++++++++++++++++++++++++++++
hugoista.el | 22 +++++++++++++---------
2 files changed, 52 insertions(+), 9 deletions(-)
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000000..45165853b2
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,39 @@
+NEWS for https://codeberg.org/c-alpha/hugoista
+========================================================================
+Release Notes for Version 0.2.1
+========================================================================
+
+Issues Resolved with This Version
+---------------------------------
+- [Issue #3] The test for detecting a Hugo site directory was
+ considering simple setups only, that is with the Hugo config file at
+ the root of the site's directory tree. Advanced configurations with
+ a set of configuration files in the config subdirectory are now also
+ recognised as Hugo site directories.
+
+New in This Version
+-------------------
+None.
+
+Known Problems and Limitations
+------------------------------
+None.
+
+========================================================================
+Release Notes for Version 0.2.0
+========================================================================
+
+Issues Resolved with This Version
+---------------------------------
+None.
+
+New in This Version
+-------------------
+- Add GNU ELPA installation instructions to readme.
+- Bump version to 0.2.0 to trigger GNU ELPA publication.
+
+Known Problems and Limitations
+------------------------------
+None.
+
+---------------------------- End of NEWS -------------------------------
diff --git a/hugoista.el b/hugoista.el
index 800bd6a0d9..45f955054b 100644
--- a/hugoista.el
+++ b/hugoista.el
@@ -4,7 +4,7 @@
;; Author: Alexander Adolf <[email protected]>, Thanos
Apollo <[email protected]>
;; Maintainer: Alexander Adolf <[email protected]>
-;; Version: 0.2.0
+;; Version: 0.2.1
;; Package-Requires: ((emacs "24.3") seq)
;; Homepage: https://codeberg.org/c-alpha/hugoista
@@ -257,14 +257,18 @@ CONTENT-GROUPS is a grouped list in the format produced by
(defun hugoista--hugo-site-dir-p (dir)
"Test whether DIR is a Hugo site directory."
- (> (length (directory-files dir nil
- (rx bos
- (or "hugo" "config")
- "."
- (or "toml" (seq "y" (opt "a") "ml"))
- eos)
- t))
- 0))
+ (let* ((cfgrx (rx bos
+ (or "hugo" "config")
+ "."
+ (or "toml" (seq "y" (opt "a") "ml"))
+ eos))
+ (cfgsubdir (expand-file-name "config" dir))
+ (rootcfgs (length (directory-files dir nil cfgrx t)))
+ (subdircfgs (if (file-directory-p cfgsubdir)
+ (length (directory-files-recursively cfgsubdir cfgrx
+ nil nil t))
+ 0)))
+ (> (+ rootcfgs subdircfgs) 0)))
;;;; Interactive Functions