Skip to content

Commit

Permalink
feat(io): add a helper to save URLs to HTML snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Apr 15, 2023
1 parent 0c3dc30 commit 24e03db
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion elisp/+io.el
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ If FORCE-P, overwrite the destination file if it exists, without confirmation."
(replace-regexp-in-string
"[:;\t\n\r /\\_]+" "-"
(replace-regexp-in-string
"[‘’‚’“”„”\"`'()]+" ""
"[‘’‚’“”„”\"`'()&]+" ""
(if downcase-p (downcase filename) filename))))

(defcustom +html2pdf-default-backend 'wkhtmltopdf
Expand Down Expand Up @@ -267,4 +267,20 @@ When MAIL-MODE-P is non-nil, treat INFILE as a mail."
"PDF created but with some errors!"
"An error occured, cannot create the PDF!")))))

;;;###autoload
(defcustom +single-file-executable (executable-find "single-file")
"The executable for \"single-file\" which is used archive HTML pages.")

;;;###autoload
(defun +single-file (url out-file)
"Save URL into OUT-FILE as a standalone HTML file."
(when +single-file-executable
(make-process
:name "single-file-cli"
:buffer "*single-file*"
:command (list
+single-file-executable
"--browser-executable-path" browse-url-chromium-program
url out-file))))

;;; +io.el ends here

0 comments on commit 24e03db

Please sign in to comment.