emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* to bookmarks
@ 2009-09-26 13:59 andrea Crotti
  2009-09-26 18:35 ` Andreas Burtzlaff
  2009-09-26 19:39 ` Matt Lundin
  0 siblings, 2 replies; 4+ messages in thread
From: andrea Crotti @ 2009-09-26 13:59 UTC (permalink / raw)
  To: emacs-orgmode

Bookmarks from org-mode:
   
   I insert many many links inside my orgmode but sometimes I would also like to have them in my 
browsers (safari and firefox sometimes).
   
   Is there already something working out of the box?
   
   The hierarchy like
   <file.org>
   * level1
   ** level2
      [[http://sito.com][sito]]
   
Should maybe create directories, for a cleaner view..

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: to bookmarks
  2009-09-26 13:59 to bookmarks andrea Crotti
@ 2009-09-26 18:35 ` Andreas Burtzlaff
  2009-09-26 19:39 ` Matt Lundin
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Burtzlaff @ 2009-09-26 18:35 UTC (permalink / raw)
  To: andrea Crotti; +Cc: emacs-orgmode

On Sat, 26 Sep 2009 13:59:49 +0000 (UTC)
andrea Crotti <andrea.crotti.0@gmail.com> wrote:

> Bookmarks from org-mode:
>    
>    I insert many many links inside my orgmode but sometimes I would also like to have them in my 
> browsers (safari and firefox sometimes).
>
>    Is there already something working out of the box?

How about exporting the org file to html and open that with your
browser?
Perhaps create a sparse tree for all links in the file first, e.g.:

(defun ab-org-sparse-tree-show-links ()
  (interactive)
  (org-occur org-any-link-re))

and then only export the visible content using C-c C-e v h

Andreas

P.S. I planned such a feature for Fireforg but haven't implemented it
yet; partly because I haven't figured out how to filter and export an
org-file structure to xml in a customizable way, without reinventing
the wheel.

>    
>    The hierarchy like
>    <file.org>
>    * level1
>    ** level2
>       [[http://sito.com][sito]]
>    
> Should maybe create directories, for a cleaner view..
> 
> 
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: to bookmarks
  2009-09-26 13:59 to bookmarks andrea Crotti
  2009-09-26 18:35 ` Andreas Burtzlaff
@ 2009-09-26 19:39 ` Matt Lundin
  2009-09-26 19:48   ` Matthew Lundin
  1 sibling, 1 reply; 4+ messages in thread
From: Matt Lundin @ 2009-09-26 19:39 UTC (permalink / raw)
  To: andrea Crotti; +Cc: emacs-orgmode

andrea Crotti <andrea.crotti.0@gmail.com> writes:

> Bookmarks from org-mode:
>    
>    I insert many many links inside my orgmode but sometimes I would also like to have them in my 
> browsers (safari and firefox sometimes).
>    
>    Is there already something working out of the box?
>    
>    The hierarchy like
>    <file.org>
>    * level1
>    ** level2
>       [[http://sito.com][sito]]
>    
> Should maybe create directories, for a cleaner view..

I've been looking for similar functionality for a while so I hacked up a
simple function to export the bookmarks of an org file as an html file,
which can then -- at least theoretically ;) -- be imported into your
favorite web browser. I'm an elisp novice, but it seems to work:

--8<---------------cut here---------------start------------->8---
(defun org-export-html-bookmarks ()
  "Extract bookmarks from the current org file and create an html file that
can be imported into a web browser."
  (interactive)
  (let ((file (file-name-nondirectory (buffer-file-name)))
	bookmarks)
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward org-bracket-link-analytic-regexp nil t)
      (when (equal (match-string 2) "http")
	(let ((url (concat (match-string 1)
			   (match-string 3)))
	      (desc (org-substring-no-properties (match-string 5))))
	  (push (concat "<DT><A HREF=\"" url "\">" desc "</A>\n") bookmarks))))
    (with-temp-buffer 
      (insert
       "<!DOCTYPE NETSCAPE-Bookmark-file-1>\n"
       "<HTML>\n"
       "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n"
       "<Title>Bookmarks</Title>\n"
       "<H1>Bookmarks</H1>\n"
       "<DT><H3 FOLDED>" file " (" (format-time-string "%Y-%m-%d") ")</H3>\n"
       "<DL><p>\n")
      (apply 'insert (nreverse bookmarks))
      (insert
       "</DL><p>\n"
       "</HTML>")
      (write-file (concat (file-name-sans-extension file) "-bookmarks.html"))))))
--8<---------------cut here---------------end--------------->8---

I'll put it up in the "hacks" section on Worg.

Regards,

Matt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: to bookmarks
  2009-09-26 19:39 ` Matt Lundin
@ 2009-09-26 19:48   ` Matthew Lundin
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Lundin @ 2009-09-26 19:48 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode, andrea Crotti

Matt Lundin <mdl@imapmail.org> writes:

> I've been looking for similar functionality for a while so I hacked up a
> simple function to export the bookmarks of an org file as an html
> file,

Here's a better version of the function:

--8<---------------cut here---------------start------------->8---
(defun org-export-html-bookmarks ()
  "Extract bookmarks from the current org file and create an html file that
can be imported into a web browser."
  (interactive)
  (unless (eq major-mode 'org-mode) 
    (error "Not in an org buffer"))
  (let ((file (file-name-nondirectory (buffer-file-name)))
	bookmarks)
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward org-bracket-link-analytic-regexp nil t)
      (when (equal (match-string 2) "http")
	(let ((url (concat (match-string 1)
			   (match-string 3)))
	      (desc (match-string 5)))
	  (push (concat "<DT><A HREF=\"" url "\">" desc "</A>\n") bookmarks))))
    (with-temp-buffer 
      (insert
       "<!DOCTYPE NETSCAPE-Bookmark-file-1>\n"
       "<HTML>\n"
       "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n"
       "<Title>Bookmarks</Title>\n"
       "<H1>Bookmarks</H1>\n"
       "<DT><H3 FOLDED>" file " (" (format-time-string "%Y-%m-%d") ")</H3>\n"
       "<DL><p>\n")
      (apply 'insert (nreverse bookmarks))
      (insert
       "</DL><p>\n"
       "</HTML>")
      (write-file (concat (file-name-sans-extension file) "-bookmarks.html"))))))
--8<---------------cut here---------------end--------------->8---

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-26 19:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-26 13:59 to bookmarks andrea Crotti
2009-09-26 18:35 ` Andreas Burtzlaff
2009-09-26 19:39 ` Matt Lundin
2009-09-26 19:48   ` Matthew Lundin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).