Skip to content

Commit

Permalink
Revert "Move auto-export on save stuff to new ox-hugo-sugar.el"
Browse files Browse the repository at this point in the history
This reverts commit 4e93151.

This move needs to be better planned out.. this commit broke
auto-loading of ox-hugo using org-hugo-export-wim-to-md-after-save.
  • Loading branch information
kaushalmodi committed Aug 10, 2018
1 parent 0e9c312 commit 358929b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 46 deletions.
44 changes: 0 additions & 44 deletions ox-hugo-sugar.el

This file was deleted.

30 changes: 28 additions & 2 deletions ox-hugo.el
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@
(require 'ob-core) ;For `org-babel-parse-header-arguments'
(declare-function org-hugo-pandoc-cite--parse-citations-maybe "ox-hugo-pandoc-cite")

(require 'ox-hugo-sugar)

(defvar ffap-url-regexp) ;Silence byte-compiler


;; Using the correct function for getting inherited Org tags.
;; Starting Org 9.2, `org-get-tags' returns all the inherited tags
;; instead of returning only the local tags i.e. only the current
Expand Down Expand Up @@ -137,6 +136,20 @@ Pandoc understands meta-data only in YAML format. So when Pandoc
Citations are enabled, Pandoc is handed over the file with this
YAML front-matter.")

(defvar org-hugo-allow-export-after-save t
"Enable flag for `org-hugo-export-wim-to-md-after-save'.
When nil, the above function will not export the Org file to
Hugo-compatible Markdown.
This variable is usually set to nil by the user in
`org-capture-before-finalize-hook' and set to t again in
`org-capture-after-finalize-hook', so that the export does not
happen as soon as a new post is created using Org capture.
Note that the export after save will not work until
`org-hugo-export-wim-to-md-after-save' is added to the
`after-save-hook' by the user.")

(defvar org-hugo-blackfriday-options
'("taskLists"
"smartypants"
Expand Down Expand Up @@ -3649,6 +3662,19 @@ approach)."
(when do-export
(org-hugo-export-to-md async subtree visible-only)))))))))

;;;###autoload
(defun org-hugo-export-wim-to-md-after-save ()
"Fn for `after-save-hook' to run `org-hugo-export-wim-to-md'.
The export is also skipped if `org-hugo-allow-export-after-save'
is nil. This variable is intended to be toggled dynamically in
`org-capture-before-finalize-hook' and
`org-capture-after-finalize-hook' hooks. See the ‘Auto-export on
Saving’ section in this package's documentation for an example."
(save-excursion
(when org-hugo-allow-export-after-save
(org-hugo-export-wim-to-md))))

;;;###autoload
(defun org-hugo-debug-info ()
"Get Emacs, Org and Hugo version and ox-hugo customization info.
Expand Down

0 comments on commit 358929b

Please sign in to comment.