ox-hugo
ox-hugo copied to clipboard
fix: properly escape dot in directory-files regex, fixes false matches
It appears that the original regex took \.
as a single dot (any character) rather than a literal dot.
I assume it's because single backslashes are dropped in emacs strings if the character following needs no escape as part of a string. However that's desired in the regex.
See https://www.gnu.org/software/emacs/manual/html_node/elisp/Syntax-for-Strings.html
In my case, it matched a ./beorg
subdir causing a further error during the export process -- not a regular file
.
I misidentified the issue I had. Turns out it was coming from a misconfigured value for org-agenda-text-search-extra-files
which included an empty string in the list, causing the returned file list to also include the current directory. I'll close this PR, apologies for the noise here :raised_hands:
No worries! I'm glad you sorted it out.
I just switched to a new computer where I had not mangled the ox-hugo.el
code. It had the same issue.
It can be tested by adding a non-regular file, eg. a dir ending in "org" in the current directory of the file to be exported. The code below should reproduce the problem, ran in the buffer to be exported.
(make-directory "foo-org")
(org-hugo-export-wim-to-md)
This should error with "not a regular file .../foo-org"
. I guess the changes in this PR are ok after all.