Skip to content

Commit

Permalink
Merge: Show Pandoc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alphapapa committed Dec 20, 2023
2 parents 69d161b + 3e1d117 commit abc2c03
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ After installing from MELPA, just run one of the [[*Usage][commands]] below. If

** 1.3-pre

*Changes*
+ Errors from Pandoc are now displayed. ([[https://github.com/alphapapa/org-web-tools/pull/47][#47]]. Thanks to [[https://github.com/c1-g][c1-g]].)

*Fixes*
+ Default options to Wget (see [[https://github.com/alphapapa/org-web-tools/issues/35][#35]]).
+ Finding URL in clipboard on MacOS and Windows. (See [[https://github.com/alphapapa/org-web-tools/pull/66][#66]]. Thanks to [[https://github.com/askdkc][@askdkc]].)
Expand Down
24 changes: 15 additions & 9 deletions org-web-tools.el
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,21 @@ When SELECTOR is non-nil, the HTML is filtered using
(org-web-tools--dom-to-html))))
(with-temp-buffer
(insert html)
(unless (zerop (call-process-region (point-min) (point-max) "pandoc"
t t nil
(org-web-tools--pandoc-no-wrap-option)
"-f" "html-raw_html-native_divs" "-t" "org"))
;; TODO: Add error output, see org-protocol-capture-html
(error "Pandoc failed"))
(org-mode)
(org-web-tools--clean-pandoc-output)
(buffer-string)))
(let ((stderr-file (make-temp-file "org-web-tools-pandoc-stderr")))
(unwind-protect
(if (not (zerop (call-process-region (point-min) (point-max) "pandoc"
t (list t stderr-file) nil
"--verbose"
(org-web-tools--pandoc-no-wrap-option)
"-f" "html-raw_html-native_divs" "-t" "org")))
(progn
(delete-region (point-min) (point-max))
(insert-file-contents stderr-file)
(error "Pandoc failed: %s" (buffer-string)))
(org-mode)
(org-web-tools--clean-pandoc-output)
(buffer-string))
(delete-file stderr-file)))))

(defun org-web-tools--pandoc-no-wrap-option ()
"Return option `org-web-tools--pandoc-no-wrap-option', setting if unset."
Expand Down

0 comments on commit abc2c03

Please sign in to comment.