Makefile, ox-hugo.el message formatting improvements

* ox-hugo.el:
  - Print the number of subtree being exported when doing C-c C-e H A.
  - Print the tag that caused a subtree/file to not be exported.
  - Misc message and code formatting improvements.
* .travis.yml: Disable the Entering directory/Leaving directory noise
  from make.
* Makefile: Add a blank line before each new instance of emacs in
  batch mode.
master
Kaushal Modi 8 years ago
parent d7db49500a
commit 8e2a569e77
  1. 6
      .travis.yml
  2. 4
      Makefile
  3. 42
      ox-hugo.el

@ -18,9 +18,9 @@ install:
- export EMACS=/tmp/emacs/bin/emacs - export EMACS=/tmp/emacs/bin/emacs
- $EMACS --version - $EMACS --version
script: script:
- make doc EMACS=${EMACS} # Just ensure that "make doc" doesn't fail for any reason.. this is *not* used to do Org->Markdown doc conversion using Travis. - make --no-print-directory doc EMACS=${EMACS} # Just ensure that "make doc" doesn't fail for any reason.. this is *not* used to do Org->Markdown doc conversion using Travis.
- make test EMACS=${EMACS} - make --no-print-directory test EMACS=${EMACS}
- make vcheck EMACS=${EMACS} - make --no-print-directory vcheck EMACS=${EMACS}
notifications: notifications:
email: email:
# Default is change, but that includes a new branch's 1st success. # Default is change, but that includes a new branch's 1st success.

@ -1,4 +1,4 @@
# Time-stamp: <2017-12-01 10:44:11 kmodi> # Time-stamp: <2017-12-02 00:57:10 kmodi>
# Makefile to export org documents to md for Hugo from the command line # Makefile to export org documents to md for Hugo from the command line
# Run just "make" to see usage examples. # Run just "make" to see usage examples.
@ -104,6 +104,8 @@ help:
# loads the new Org version.. and thus we'll end up with mixed Org in # loads the new Org version.. and thus we'll end up with mixed Org in
# the load-path. # the load-path.
emacs-batch: emacs-batch:
@echo ""
@echo "$(ORG_FILE) ::"
@$(EMACS) --batch --eval "(progn\ @$(EMACS) --batch --eval "(progn\
(setenv \"OX_HUGO_ELPA\" \"$(OX_HUGO_ELPA)\")\ (setenv \"OX_HUGO_ELPA\" \"$(OX_HUGO_ELPA)\")\
(when (> (length \"$(TIMEZONE)\") 0) (setenv \"TZ\" \"$(TIMEZONE)\"))\ (when (> (length \"$(TIMEZONE)\") 0) (setenv \"TZ\" \"$(TIMEZONE)\"))\

@ -1926,7 +1926,7 @@ INFO is a plist used as a communication channel."
"true") "true")
((and todo-keyword ((and todo-keyword
(string= "DRAFT" todo-keyword)) (string= "DRAFT" todo-keyword))
(message "[ox-hugo] `%s' post is marked as a draft" title) (message "[ox-hugo] `%s' post is marked as a DRAFT" title)
"true") "true")
((org-hugo--plist-get-true-p info :hugo-draft) ((org-hugo--plist-get-true-p info :hugo-draft)
(org-hugo--front-matter-value-booleanize (org-hugo--plist-get-true-p info :hugo-draft))) (org-hugo--front-matter-value-booleanize (org-hugo--plist-get-true-p info :hugo-draft)))
@ -2378,24 +2378,26 @@ Return output file's name."
;; (message "[org-hugo-export-to-md DBG] section-dir = %s" section-dir) ;; (message "[org-hugo-export-to-md DBG] section-dir = %s" section-dir)
(unless subtreep (unless subtreep
;; Below stuff applies only to per-file export flow. ;; Below stuff applies only to per-file export flow.
(let ((org-use-tag-inheritance t) (let ((fname (file-name-nondirectory (buffer-file-name)))
(org-use-tag-inheritance t)
;; `org-get-tags' returns a list of tags *only* ;; `org-get-tags' returns a list of tags *only*
;; at the current heading; `org-get-tags-at' ;; at the current heading; `org-get-tags-at'
;; returns inherited tags too. ;; returns inherited tags too.
(all-tags (org-get-tags-at))) (all-tags (org-get-tags-at))
(dolist (exclude-tag org-export-exclude-tags) matched-exclude-tag)
(when (member exclude-tag all-tags) (when all-tags
(setq do-export nil))) (dolist (exclude-tag org-export-exclude-tags)
(when (member exclude-tag all-tags)
(setq matched-exclude-tag exclude-tag)
(setq do-export nil))))
(if do-export (if do-export
(progn (progn
;; Reset the variables that are used only for subtree exports. ;; Reset the variables that are used only for subtree exports.
(setq org-hugo--subtree-count 0) (setq org-hugo--subtree-count 0)
(setq org-hugo--subtree-coord nil) (setq org-hugo--subtree-coord nil)
(message "[ox-hugo file] Exporting `%s' (%s)" (message "[ox-hugo] Exporting `%s' (%s)" title fname))
title (file-name-nondirectory (buffer-file-name)))) (message "[ox-hugo] %s was not exported as it is tagged with an exclude tag `%s'"
(message (concat "[ox-hugo file] `%s' was not exported as that file " fname matched-exclude-tag))))
"was tagged with one of `org-export-exclude-tags'")
title))))
(when do-export (when do-export
(prog1 (prog1
(org-export-to-file 'hugo outfile async subtreep visible-only) (org-export-to-file 'hugo outfile async subtreep visible-only)
@ -2487,7 +2489,7 @@ approach)."
(ignore-errors (ignore-errors
(org-back-to-heading :invisible-ok)) (org-back-to-heading :invisible-ok))
(let ((subtree (org-hugo--get-valid-subtree)) (let ((subtree (org-hugo--get-valid-subtree))
is-commented is-excluded do-export) is-commented is-excluded matched-exclude-tag do-export)
(if subtree (if subtree
(progn (progn
;; If subtree is a valid Hugo post subtree, proceed .. ;; If subtree is a valid Hugo post subtree, proceed ..
@ -2498,9 +2500,11 @@ approach)."
;; at the current heading; `org-get-tags-at' ;; at the current heading; `org-get-tags-at'
;; returns inherited tags too. ;; returns inherited tags too.
(all-tags (org-get-tags-at))) (all-tags (org-get-tags-at)))
(dolist (exclude-tag org-export-exclude-tags) (when all-tags
(when (member exclude-tag all-tags) (dolist (exclude-tag org-export-exclude-tags)
(setq is-excluded t)))) (when (member exclude-tag all-tags)
(setq matched-exclude-tag exclude-tag)
(setq is-excluded t)))))
;; (message "[current subtree DBG] subtree: %S" subtree) ;; (message "[current subtree DBG] subtree: %S" subtree)
;; (message "[current subtree DBG] is-commented:%S, tags:%S, is-excluded:%S" ;; (message "[current subtree DBG] is-commented:%S, tags:%S, is-excluded:%S"
@ -2508,13 +2512,15 @@ approach)."
(let ((title (org-element-property :title subtree))) (let ((title (org-element-property :title subtree)))
(cond (cond
(is-commented (is-commented
(message "[ox-hugo] `%s' was not exported as that subtree is commented" title)) (message "[ox-hugo] `%s' was not exported as that subtree is commented"
title))
(is-excluded (is-excluded
(message "[ox-hugo] `%s' was not exported as it is tagged with one of `org-export-exclude-tags'" title)) (message "[ox-hugo] `%s' was not exported as it is tagged with an exclude tag `%s'"
title matched-exclude-tag))
(t (t
(message "[ox-hugo] Exporting `%s' .." title)
(when (numberp org-hugo--subtree-count) (when (numberp org-hugo--subtree-count)
(setq org-hugo--subtree-count (1+ org-hugo--subtree-count))) (setq org-hugo--subtree-count (1+ org-hugo--subtree-count)))
(message "[ox-hugo] %d/ Exporting `%s' .." org-hugo--subtree-count title)
;; Get the current subtree coordinates for ;; Get the current subtree coordinates for
;; auto-calculation of menu item weight or post ;; auto-calculation of menu item weight or post
;; weight. ;; weight.

Loading…
Cancel
Save