diff options
-rw-r--r-- | TODOs.org | 3 | ||||
-rw-r--r-- | hnreader.el | 15 |
2 files changed, 14 insertions, 4 deletions
@@ -33,3 +33,6 @@ or recursive on dom will be just fine * DONE comment page show main link and intro text * TODO display page takes page number * TODO reload page +* TODO frontpage has next page link +* remove * in text +find and replace raw htlm '< *' with '< -' diff --git a/hnreader.el b/hnreader.el index 5ac7aec..7f54cf8 100644 --- a/hnreader.el +++ b/hnreader.el @@ -29,7 +29,11 @@ third one is 80.") (promise-new (lambda (resolve reject) (request url - :parser (lambda () (libxml-parse-html-region (point-min) (point-max))) + :parser (lambda () + (goto-char (point-min)) + (while (re-search-forward ">\\*" nil t) + (replace-match ">-")) + (libxml-parse-html-region (point-min) (point-max))) :error (cl-function (lambda (&rest args &key error-thrown &allow-other-keys) (funcall reject error-thrown))) :success (cl-function (lambda (&key data &allow-other-keys) @@ -77,7 +81,8 @@ third one is 80.") (insert "#+STARTUP: overview indent\n") (cl-mapcar #'hnreader--print-frontpage-item things subtexts) ;; (setq-local org-confirm-elisp-link-function nil) - (org-mode)))) + (org-mode) + (goto-line 3)))) (defun hnreader--get-title (dom) "Get title and link from DOM comment page." @@ -91,7 +96,7 @@ third one is 80.") (with-current-buffer (hnreader--get-hn-comment-buffer) (read-only-mode -1) (erase-buffer) - (insert "#+STARTUP: overview indent\n") + (insert "#+STARTUP: indent\n") (insert "#+TITLE: " (car title)) (insert "\n" (cdr title)) (dolist (comment comments) @@ -102,7 +107,9 @@ third one is 80.") (hnreader--get-comment-owner comment))) (let ((shr-width 80)) (shr-insert-document (hnreader--get-comment comment)))) - (org-mode)))) + (org-mode) + (org-shifttab 3) + (goto-line 3)))) (defun hnreader--get-img-tag-width (comment-dom) "Get width attribute of img tag in COMMENT-DOM." |