Re: [O] Re: [Orgmode] A way to export agenda with links into org-files to html ?

2011-03-02 Thread Hrvoje Niksic
Bastien b...@altern.org writes:

 I see.  So (thing-at-point 'url) would return the url/uri depending on
 that 'uri-ref property.  But as far as I've understood, thing-at-point
 does not rely on properties -- am I wrong?

I am proposing a new property which currently available software of
course does not support.  If we promote it, maybe programmers of these
other modes will like it enough to support it.

 Unless such a property can be used with thing-at-point (for
 `browse-url' and other commands), I'd rather put the burden of finding
 the proper ref to htmlize, based on the help-echo area...

 What do you think?

I think that the help-echo text is not a robust way to detect URLs.  For
example, org-mode's help-echo text is LINK: url, someone else will use
just the URL, others will translate link, and yet others will not use
help-echo at all.

Modes need a reliable way to tell htmlize (and other interesting
parties) about URI references in the buffer.  A property seems like an
obvious way to do so, and I'd prefer the property not to be specific to
htmlize.

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[O] Re: [Orgmode] A way to export agenda with links into org-files to html ?

2011-02-28 Thread Hrvoje Niksic
Bastien b...@altern.org writes:

 This are the typical text properties for an Org-mode link:

   face org-link
   help-echoLINK: http://bonjour.fr;
   mouse-face   highlight

These three properties (face, help-echo, mouse-face) are general, which
would require htmlize to deduce URLs from them much like it now deduces
URLs by examining buffer text.  I would like to offer a better
alternative.

What I had in mind is a general property that marks a URI reference.
For example, a `uri-ref' property could refer to the URI that would
cause htmlize to generate an a href=... link, `browse-url' to react
to mouse clicks to that area, etc.  The property value would typically
be a string containing the URI, but could also be a plist describing the
reference.

;; just the URI
(put-text-property beg end 'uri-ref http://bonjour.fr;)

;; the same, with the ability to specify additional props of this ref
(put-text-property beg end 'uri-ref '(:uri http://bonjour.fr;))

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [PATCH] Markup on same line as text

2011-02-19 Thread Hrvoje Niksic
Roland Kaufmann roland.kaufm...@gmail.com writes:

 htmlize doesn't operate on the level of syntax-based fontification, it
 examines the display-related properties attached to buffer text (not
 necessarily by font-lock) and renders them into the corresponding HTML.

 Good point.

 And, as you point out, it is probably better to deal with the problem
 by removing the formatting on the newlines (probably right after
 font-lock-fontify-buffer in org-export-format-source-code-or-example)
 in the temporary buffer that is htmlize'd, reducing the chance of any
 unintended consequences.

Yes, tweaking the properties seems preferable to tweaking htmlize itself
for this particular case.

In the future I'd like htmlize to be more extensible about converting
buffer contents to HTML.  Currently it only examines the `face' and
`invisible' properties that Emacs itself uses for display.  But
additional properties could be defined, which htmlize would use to
discern hyperlinks, or to add line highlight markup, to override choice
of style sheet, etc.

 I'll try this approach and see how it turns out (i.e. proposal for
 change in htmlize dropped). Thank you for the feedback!

Thanks for sticking with this.  Please let me know how it works for you.

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] A way to export agenda with links into org-files to html ?

2011-02-18 Thread Hrvoje Niksic
[ Please keep me in the Cc when replying ]

Bastien bastien.gue...@wikimedia.fr writes:

 and how should htmlize find them in the buffer?

 See org-*-link-regexp regular expressions.

I was thinking in a more general way.

Maybe applications such as orgmode could mark hyperlinks with text
properties and htmlize could recognize them and convert them to real
links, without fragile (and slow) regexp magic.

For example, Gnus uses the `mouse-face' property to highlight the URLs
in the article buffer.  The `button' property contains the details about
the button.

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] A way to export agenda with links into org-files to html ?

2011-02-17 Thread Hrvoje Niksic
Bastien bastien.gue...@wikimedia.fr writes:

 Sadly enough, htmlize.el only handles http://orgmode.org links. 

 Patch to make htmlize.el handle org links welcome!

htmlize looks for urls and converts them to links.  What are org links
that you refer to, and how should htmlize find them in the buffer?

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [PATCH] Markup on same line as text

2011-02-17 Thread Hrvoje Niksic
Sorry for taking a very long time to respond.

Roland Kaufmann roland.kaufm...@gmail.com writes:
 (let ((x 42)) span style=comment; meaning of l.u.e.
 span id=ref-2/span  (print x))/span
  ^^^
 The first closing tag is really the end of the comment which is
 spilled to the next line, but it erraneously closes the id span.

If so, that would be a bug in htmlize.  While Emacs supports arbitrarily
overlapping properties/overlays/extents, HTML doesn't, and htmlize is
normally careful to describe each unchanged run of text on its own.

I am not familiar with org-mode, so I will need a description of exactly
how to reproduce this bug.  Specifically I don't know how to put a
reference on the next line.

Your patch may work in this particular case, but the idea behind htmlize
is to describe the state of the buffer.  If a property ends after the
newline, it is intended that the generated HTML reflect this.

Hrvoje

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [PATCH] Markup on same line as text

2011-02-17 Thread Hrvoje Niksic
[ Please include me in the replies, as I'm not subscribed to emacs-orgmode. ]

  Your patch may work in this particular case, but the idea behind
  htmlize is to describe the state of the buffer.  If a property ends
  after the newline, it is intended that the generated HTML reflect
 
 The philosophical question is then: Is the newline character part of the 
 syntax construct that is being fontified, or rather a formatting code 
 that should be kept separate?

htmlize doesn't operate on the level of syntax-based fontification, it
examines the display-related properties attached to buffer text (not
necessarily by font-lock) and renders them into the corresponding HTML.

If a display property includes the newline character, that will be
reflected in the HTML.  This works fine for displaying in a browser, but
confuses org-mode's post-processing of HTML, which (if my understanding
is correct) assumes that spans will be closed before the newline.  This
assumption is wrong in the case you present.

However, using htmlize-before-hook, it is trivial to make the assumption
correct by resetting the property.  Here is your example, modified to do
so:

(let ((filename (expand-file-name foo.org temporary-file-directory)))
   (switch-to-buffer (find-file-noselect filename))
   (erase-buffer)
   (insert *
#+BEGIN_SRC emacs-lisp
(let ((x 42)) ; meaning of l.u.e.
   (print x))  ; (ref:2)
#+END_SRC)
   (save-buffer)
   (org-mode)
   (let ((htmlize-before-hook htmlize-before-hook))
 (add-hook 'htmlize-before-hook
   (lambda ()
 (goto-char (point-min))
 (while (progn (end-of-line) (not (eobp)))
   (put-text-property (point) (1+ (point)) 'face nil)
   (forward-char 1
 (org-export-as-html nil)))

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode