Refactor: HUGO_EXPORT_DIR -> HUGO_BASE_DIR

Found the earlier name confusing as the value actually represents the
base directory for the Hugo site development. The posts are actually
exported to a content/ subdir under that.
master
Kaushal Modi 9 years ago
parent 3e58ef9f5b
commit 7e5248f927
  1. 2
      doc/ox-hugo-manual.org
  2. 14
      ox-hugo.el
  3. 2
      tests/org/prop-drawer-parsing/prop-drawer-parsing.org
  4. 2
      tests/org/small1/small1.org
  5. 2
      tests/org/tags-and-keywords/tags-and-keywords.org

@ -9,7 +9,7 @@ Markdown]] flavor.
[[http://gohugo.io/content/sections/][here]] for more information on Hugo sections. It is
common for this property to be set to =posts= or
=blog=.
- HUGO_EXPORT_DIR :: Root directory of the source for the Hugo site.
- HUGO_BASE_DIR :: Root directory of the source for the Hugo site.
If this is set to =~/hugo/=, the exported Markdown files will be
saved to =~/hugo/content/<HUGO_SECTION>/= directory. By [[http://gohugo.io/content/organization/][default]],
the Markdown files reside in a hierarchy under the =content/=

@ -107,7 +107,7 @@ directory where all Hugo posts should go by default."
(:hugo-url "HUGO_URL" nil nil)
;; Non-front-matter options
(:hugo-section "HUGO_SECTION" nil org-hugo-default-section-directory)
(:hugo-export-dir "HUGO_EXPORT_DIR" nil nil)
(:hugo-base-dir "HUGO_BASE_DIR" nil nil)
(:hugo-static-images "HUGO_STATIC_IMAGES" nil "images")))
@ -222,13 +222,13 @@ PATH is the path to the image or pdf attachment.
INFO is a plist used as a communication channel."
(message "[ox-hugo DBG] The Hugo sectioimage dir is: %s" (plist-get info :hugo-static-images) )
(message "[ox-hugo DBG] The Hugo section is: %s" (plist-get info :hugo-section) )
(message "[ox-hugo DBG] The Hugo export dir is: %s" (plist-get info :hugo-export-dir) )
(message "[ox-hugo DBG] The Hugo base dir is: %s" (plist-get info :hugo-base-dir) )
(let* ((full-path (file-truename path))
(exportables '("jpg" "jpeg" "tiff" "png" "pdf" "odt" ))
(file-name (file-name-nondirectory path))
(image-export-dir (concat
(file-name-as-directory (plist-get info :hugo-export-dir))
(file-name-as-directory (plist-get info :hugo-base-dir))
"static/"
(file-name-as-directory (plist-get info :hugo-static-images))
))
@ -413,14 +413,14 @@ Return output file's name."
'hugo subtreep visible-only)
(org-export--get-buffer-attributes)
(org-export-get-environment 'hugo subtreep)))
(export-dir-path (if (null (plist-get info :hugo-export-dir))
(user-error "It is mandatory to set the HUGO_EXPORT_DIR property")
(file-name-as-directory (plist-get info :hugo-export-dir))))
(base-dir (if (null (plist-get info :hugo-base-dir))
(user-error "It is mandatory to set the HUGO_BASE_DIR property")
(file-name-as-directory (plist-get info :hugo-base-dir))))
(content-dir "content/")
(section-dir (if (null (plist-get info :hugo-section))
(user-error "It is mandatory to set the HUGO_SECTION property")
(file-name-as-directory (plist-get info :hugo-section))))
(pub-dir (let ((dir (concat export-dir-path content-dir section-dir)))
(pub-dir (let ((dir (concat base-dir content-dir section-dir)))
(make-directory dir :parents) ;Create the directory if it does not exist
dir))
(outfile (org-export-output-file-name ".md" subtreep pub-dir)))

@ -1,5 +1,5 @@
#+TITLE: My Blog
#+HUGO_EXPORT_DIR: ../../md/
#+HUGO_BASE_DIR: ../../md/
#+HUGO_SECTION: posts
# 1. Load `ox-hugo'

@ -1,5 +1,5 @@
#+TITLE: My Blog
#+HUGO_EXPORT_DIR: ../../md/
#+HUGO_BASE_DIR: ../../md/
#+HUGO_SECTION: posts
# 1. Load `ox-hugo'

@ -1,5 +1,5 @@
#+TITLE: My Blog
#+HUGO_EXPORT_DIR: ../../md/
#+HUGO_BASE_DIR: ../../md/
#+KEYWORDS: alpha beta
# 1. Load `ox-hugo'

Loading…
Cancel
Save