From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: html to org-mode Date: Sat, 4 Jan 2014 08:48:04 -0500 Message-ID: References: <87ha9kuyyn.fsf@news.tumashu-localhost.org> <87wqigvwxz.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b874d82a8563e04ef2546fe Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzRaB-0000mO-Ou for emacs-orgmode@gnu.org; Sat, 04 Jan 2014 08:48:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VzRaA-0003WD-EK for emacs-orgmode@gnu.org; Sat, 04 Jan 2014 08:48:07 -0500 In-Reply-To: <87wqigvwxz.fsf@bzg.ath.cx> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: York Zhao , Feng Shu , emacs-orgmode --047d7b874d82a8563e04ef2546fe Content-Type: text/plain; charset=ISO-8859-1 It was actually org-feed (http://orgmode.org/worg/org-contrib/org-feed.html ). Here is an example usagethat downloads recent org-mode maillist entries and formats them in a list of org-headings. The formatter function does some character replacements, and makes the headings TODO items. I also defined a little function to speed up deleting headlines I don't want to keep. #+BEGIN_SRC emacs-lisp (defun textify (s) "strip control and escaped html ^M < > etc" (let ((output s)) ; (setq output (replace-regexp-in-string " \\| ;" " " s)) (setq output (replace-regexp-in-string "<" "<" output)) (setq output (replace-regexp-in-string ">" ">" output)) (setq output (replace-regexp-in-string """ "\"" output)) (setq output (replace-regexp-in-string "
" " " output)) (setq output (replace-regexp-in-string "" " " output)) output)) (defun my-formatter (e) "format for rss feed to eventually do something useful" (format "* TODO %S %s %s" (textify (plist-get e :title)) (or (and (plist-get entry :guid-permalink) (plist-get entry :guid)) (plist-get entry :link)) (textify (plist-get e :description)))) (let* ((org-feed-alist `(("org" "http://rss.gmane.org/messages/complete/gmane.emacs.orgmode" "feeds-org.org" "org-mode" :formatter my-formatter)))) (org-feed-update-all)) ;; convenience to delete uninteresting articles (defun delete-headline () (interactive) (org-mark-subtree) (delete-forward-char 1)) (global-set-key (kbd "") 'delete-headline) #+END_SRC John ----------------------------------- John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu On Sat, Jan 4, 2014 at 5:54 AM, Bastien wrote: > York Zhao writes: > > > What is org-rss, I couldn't find it. Can you give a link? > > This is ox-rss.el in contrib/lisp/ if you clone Org or get it > as a .zip/.tar.gz archive. > > -- > Bastien > > --047d7b874d82a8563e04ef2546fe Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Here is an example usagethat downloads recent = org-mode maillist entries and formats them in a list of org-headings. The f= ormatter function does some character replacements, and makes the headings = TODO items. I also defined a little function to speed up deleting headlines= I don't want to keep.

#+BEGIN_SRC emacs-lisp
(defun textify (s)
"strip control and= escaped html ^M &lt; &gt; etc"
(let ((output s))
;=A0 (= setq output (replace-regexp-in-string "
\\|
;" " "= ; s))
=A0 (setq output (replace-regexp-in-string "&lt;" "<&= quot; output))
=A0 (setq output (replace-regexp-in-string "&gt;= " ">" output))
=A0 (setq output (replace-regexp-in-str= ing "&quot;" "\"" output))
=A0 (setq output (replace-regexp-in-string "<br \>" "<= br>" output))
=A0 (setq output (replace-regexp-in-string "<= br\>" "
" output))
=A0 output))

(defun my-fo= rmatter (e)
=A0 "format for rss feed to eventually do something useful"
= =A0 (format "* TODO %S
%s

%s" (textify (plist-get e :ti= tle))
=A0 (or (and (plist-get entry :guid-permalink)
=A0=A0=A0 =A0= =A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0=A0 (plist-get entry :guid))
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0 (plist-get entry :link))
=A0= (textify (plist-get e :description))))

(let* ((org-feed-alist
= =A0=A0=A0=A0=A0=A0=A0 `(("org" "http://rss.gmane.org/messages/co= mplete/gmane.emacs.orgmode" "feeds-org.org" "org-mode" :formatter my-formatter)))) =A0 (org-feed-update-all))

;; convenience to delete uninteresting ar= ticles
(defun delete-headline ()
=A0 (interactive)
=A0 (org-mark-s= ubtree)
=A0 (delete-forward-char 1))

(global-set-key (kbd "&= lt;f5>") 'delete-headline)
#+END_SRC

John
-----------------------------------
John Kitchin
Associate Prof= essor
Doherty Hall A207F
Department of Chemical Engineering
Carneg= ie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

<= /div>

On Sat, Jan 4, 2014 at 5:54 AM, Bastien = <bzg@= gnu.org> wrote:
York Zhao <gt= dplatform@gmail.com> writes:

> What is org-rss, I couldn't find it. Can you give a link?

This is ox-rss.el in contrib/lisp/ if you clone Org or get it
as a .zip/.tar.gz archive.

--
=A0Bastien


--047d7b874d82a8563e04ef2546fe--