feat(blog): open the generated post in another window after export
Export ends by visiting the generated post with find-file-other-window, so the note stays visible next to the draft it produced; the git diff on the generated file acts as the review step. Pinned by an ERT test through the interactive run path.
This commit is contained in:
@@ -338,6 +338,14 @@ backslash-quote sequences in the exported post."
|
|||||||
(should (string-match-p "^tags: \\[\\]$" body))
|
(should (string-match-p "^tags: \\[\\]$" body))
|
||||||
(should (string-match-p "^image: $" body))))))
|
(should (string-match-p "^image: $" body))))))
|
||||||
|
|
||||||
|
(ert-deftest org-roam-export-blog/run-opens-the-generated-post ()
|
||||||
|
(let ((root (roeb-test--new-jekyll-root)))
|
||||||
|
(roeb-test--with-export nil root
|
||||||
|
(with-current-buffer (find-file-noselect (roeb-test--file "note.org"))
|
||||||
|
(org-roam-export-blog--run (org-roam-export-blog--jekyll-target)))
|
||||||
|
(should (get-file-buffer
|
||||||
|
(expand-file-name "_drafts/will-it-blend.md" root))))))
|
||||||
|
|
||||||
(ert-deftest org-roam-export-blog/jekyll-frontmatter-shape ()
|
(ert-deftest org-roam-export-blog/jekyll-frontmatter-shape ()
|
||||||
(let ((org-roam-export-blog-author "Willem"))
|
(let ((org-roam-export-blog-author "Willem"))
|
||||||
(should (equal
|
(should (equal
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
;; (fenced code blocks with language, H2 top-level headings, no TOC).
|
;; (fenced code blocks with language, H2 top-level headings, no TOC).
|
||||||
;; - Dropped refs, ignored attachments and unhandled constructs are
|
;; - Dropped refs, ignored attachments and unhandled constructs are
|
||||||
;; reported as warnings.
|
;; reported as warnings.
|
||||||
|
;; - The generated post is opened in another window for review.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
@@ -548,7 +549,9 @@ note has no title or the target file already exists."
|
|||||||
(cons post-path warnings)))))
|
(cons post-path warnings)))))
|
||||||
|
|
||||||
(defun org-roam-export-blog--run (target)
|
(defun org-roam-export-blog--run (target)
|
||||||
"Export the current note for TARGET and report the result."
|
"Export the current note for TARGET and report the result.
|
||||||
|
|
||||||
|
Opens the generated post in another window."
|
||||||
(let* ((result (org-roam-export-blog--export-file target (buffer-file-name)))
|
(let* ((result (org-roam-export-blog--export-file target (buffer-file-name)))
|
||||||
(path (car result))
|
(path (car result))
|
||||||
(warnings (cdr result)))
|
(warnings (cdr result)))
|
||||||
@@ -561,7 +564,8 @@ note has no title or the target file already exists."
|
|||||||
(when warnings
|
(when warnings
|
||||||
(with-output-to-temp-buffer "*org-roam-export-blog warnings*"
|
(with-output-to-temp-buffer "*org-roam-export-blog warnings*"
|
||||||
(dolist (w warnings)
|
(dolist (w warnings)
|
||||||
(princ (format "%s\n" w)))))))
|
(princ (format "%s\n" w)))))
|
||||||
|
(find-file-other-window path)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun org-roam-export-blog ()
|
(defun org-roam-export-blog ()
|
||||||
|
|||||||
Reference in New Issue
Block a user