Last active
August 19, 2019 10:34
-
-
Save bradyt/7af110fcd7c4583c079bf7cd52c9b115 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-get-good-basename-from-url (url) | |
(let* ((url (car (split-string url "#"))) | |
(fn (file-name-sans-extension | |
(file-name-nondirectory | |
(directory-file-name url))))) | |
fn)) | |
;; (unless (equal (my-get-good-basename-from-url "http://blah.org/blah/abc.html") "abc") (error "")) | |
;; (unless (equal (my-get-good-basename-from-url "http://blah.org/blah/abc") "abc") (error "")) | |
;; (unless (equal (my-get-good-basename-from-url "http://blah.org/blah/abc/") "abc") (error "")) | |
(defun my-read-webpage-in-org-mode (url) | |
(interactive "sEnter a url: ") | |
(let* ((url (car (split-string url "#"))) | |
(fn (expand-file-name | |
(concat (my-get-good-basename-from-url url) ".org") | |
"~/Downloads"))) | |
(shell-command (format "pandoc %s -o %s --columns=60" url fn)) | |
(with-current-buffer (find-file fn) | |
(perform-replace (char-to-string 160) " " nil nil nil nil nil (point-min) (point-max)) | |
(perform-replace "#+BEGIN_EXAMPLE" "#+begin_src dart" nil nil nil nil nil (point-min) (point-max)) | |
(perform-replace "#+END_EXAMPLE" "#+end_src" nil nil nil nil nil (point-min) (point-max)) | |
(perform-replace "^\\(\\** \\)\\[\\[.*\\]\\]" "\\1" nil t nil nil nil (point-min) (point-max)) | |
(perform-replace "^\\(\\** \\)<<.*>>" "\\1" nil t nil nil nil (point-min) (point-max)) | |
(save-buffer) | |
(goto-char (point-min)) | |
(org-set-startup-visibility) | |
(hl-line-mode) | |
(text-scale-set 3) | |
(setq fill-column 60)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2019-08-18 17:12:17 Sure. "All characters are themselves, | |
unbackslashed (except for backslash). Things that are special to | |
the string reader need a backslash to be special. But the regular | |
expression engine also uses backslash as a marker: so to make it | |
past the string reader, use two backslashes." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment