emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-e-html: Including ATTR_HTML: title="hover text"
@ 2012-06-07  2:08 William Crandall
  2012-06-07  2:59 ` William Crandall
  2012-06-07 19:28 ` Nicolas Goaziou
  0 siblings, 2 replies; 11+ messages in thread
From: William Crandall @ 2012-06-07  2:08 UTC (permalink / raw)
  To: Nicolas Goaziou, Jambunathan K; +Cc: emacs-orgmode

Hello Jambunathan and Nicolas,

If org-mode source text is:

--------------------------------------------------
A paragraph about
#+ATTR_HTML: title="Link hover text"
[[http://orgmode.org]]
exalting new emacs mode...
--------------------------------------------------


"M-x org-export h" generates:

--------------------------------------------------
<p>
A paragraph about
<a href="http://orgmode.org" title="Link hover text">http://orgmode.org</a>
exalting new emacs mode&hellip;
</p>
--------------------------------------------------

which is grand.


"M-x org-export-dispatch h" generates:

--------------------------------------------------
<p>
A paragraph about
</p>
<p>
<a href="http://orgmode.org">http://orgmode.org</a>
exalting new emacs mode&hellip;
</p>
--------------------------------------------------

which is less grand.


I see two needed fixes, reading
http://orgmode.org/org.html#Links-in-HTML-export

1. A new </p><p> should not be inserted before
   lines starting #+ATTR_HTML.

2. The title attribute needs to go into the <a> link.


Thanks again!

-BC

Org-mode: 7.8.11 (release_7.8.11-52-g451191)
Emacs: 24.1.50.1
Windows 7

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-07  2:08 org-e-html: Including ATTR_HTML: title="hover text" William Crandall
@ 2012-06-07  2:59 ` William Crandall
  2012-06-07 19:28 ` Nicolas Goaziou
  1 sibling, 0 replies; 11+ messages in thread
From: William Crandall @ 2012-06-07  2:59 UTC (permalink / raw)
  To: Nicolas Goaziou, Jambunathan K; +Cc: emacs-orgmode

Also, any chance of getting (parentheses) around a link
WITH a title, but without ( extra spaces )?


Org input:

--------------------------------------------------
A paragraph about a new mode (
#+ATTR_HTML: title="Link hover text"
[[./orgmode][org-mode]]
) that is really cool...
--------------------------------------------------


M-x org-export h, generates:

--------------------------------------------------
A paragraph about a new mode (
<a href="./orgmode" title="Link hover text">org-mode</a>
) that is really cool&hellip;
</p>
--------------------------------------------------

which adds the title just fine,
but it renders: ( org-mode )
                 ^        ^
* Putting the opening parentheses at the start of
  the #+ATTR_HTML line kills it.

* Putting the closing parentheses at the end of
  the link line:  ]])  kills the title attribute.



It would be great, though perhaps tricky, for
org-e-html to be able to generate a titled link,
inside parentheses, WITHOUT extra spaces.

But that may be a bridge too far.

Thanks for giving it a try!

-BC

Org-mode: 7.8.11 (release_7.8.11-52-g451191)
Emacs: 24.1.50.1
Windows 7



On Wed, Jun 6, 2012 at 7:08 PM, William Crandall <bc3141592@gmail.com> wrote:
> Hello Jambunathan and Nicolas,
>
> If org-mode source text is:
>
> --------------------------------------------------
> A paragraph about
> #+ATTR_HTML: title="Link hover text"
> [[http://orgmode.org]]
> exalting new emacs mode...
> --------------------------------------------------
>

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-07  2:08 org-e-html: Including ATTR_HTML: title="hover text" William Crandall
  2012-06-07  2:59 ` William Crandall
@ 2012-06-07 19:28 ` Nicolas Goaziou
  2012-06-07 22:26   ` William Crandall
  1 sibling, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2012-06-07 19:28 UTC (permalink / raw)
  To: William Crandall; +Cc: emacs-orgmode, Jambunathan K

Hello,

William Crandall <bc3141592@gmail.com> writes:

> If org-mode source text is:
>
> --------------------------------------------------
> A paragraph about
> #+ATTR_HTML: title="Link hover text"
> [[http://orgmode.org]]
> exalting new emacs mode...
> --------------------------------------------------

> "M-x org-export-dispatch h" generates:
>
> --------------------------------------------------
> <p>
> A paragraph about
> </p>
> <p>
> <a href="http://orgmode.org">http://orgmode.org</a>
> exalting new emacs mode&hellip;
> </p>
> --------------------------------------------------
>
> which is less grand.
>
> I see two needed fixes, reading
> http://orgmode.org/org.html#Links-in-HTML-export
>
> 1. A new </p><p> should not be inserted before
>    lines starting #+ATTR_HTML.

It sure should: you're starting a new paragraph containing a link and
"exalting new emacs mode..." text.

ATTR_HTML is an attribute for paragraphs, not links (though it may apply
on links within the paragraph).

You may want to add your title attribute with filters.


Regards,

-- 
Nicolas Goaziou

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-07 19:28 ` Nicolas Goaziou
@ 2012-06-07 22:26   ` William Crandall
  2012-06-08 13:28     ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: William Crandall @ 2012-06-07 22:26 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Jambunathan K

Hello Nicolas,

Thanks for your email. You write:

"ATTR_HTML is only for paragraphs, not links."

This puzzles me, because (1) the old exporter works fine
on links that are inside paragraphs, as my example showed,
and (2) the Manual says ATTR_HTML lines are for links:

12.5.4 Links in HTML export
http://orgmode.org/org.html#Links-in-HTML-export

If you want to specify attributes for links, you can do so using a
special #+ATTR_HTML line to define attributes that will be added to
the <a> or <img> tags. Here is an example that sets title and style
attributes for a link:

     #+ATTR_HTML: title="The Org mode homepage" style="color:red;"
     [[http://orgmode.org]]


Thanks for looking at this again!

-BC


On Thu, Jun 7, 2012 at 12:28 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Hello,
>
> William Crandall <bc3141592@gmail.com> writes:
>
>> If org-mode source text is:
>>
>> --------------------------------------------------
>> A paragraph about
>> #+ATTR_HTML: title="Link hover text"
>> [[http://orgmode.org]]
>> exalting new emacs mode...
>> --------------------------------------------------
>
>> "M-x org-export-dispatch h" generates:
>>
>> --------------------------------------------------
>> <p>
>> A paragraph about
>> </p>
>> <p>
>> <a href="http://orgmode.org">http://orgmode.org</a>
>> exalting new emacs mode&hellip;
>> </p>
>> --------------------------------------------------
>>
>> which is less grand.
>>
>> I see two needed fixes, reading
>> http://orgmode.org/org.html#Links-in-HTML-export
>>
>> 1. A new </p><p> should not be inserted before
>>    lines starting #+ATTR_HTML.
>
> It sure should: you're starting a new paragraph containing a link and
> "exalting new emacs mode..." text.
>
> ATTR_HTML is an attribute for paragraphs, not links (though it may apply
> on links within the paragraph).
>
> You may want to add your title attribute with filters.
>
>
> Regards,
>
> --
> Nicolas Goaziou

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-07 22:26   ` William Crandall
@ 2012-06-08 13:28     ` Nicolas Goaziou
  2012-06-08 17:03       ` William Crandall
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2012-06-08 13:28 UTC (permalink / raw)
  To: William Crandall; +Cc: emacs-orgmode, Jambunathan K

Hello,

William Crandall <bc3141592@gmail.com> writes:

> "ATTR_HTML is only for paragraphs, not links."
>
> This puzzles me, because (1) the old exporter works fine
> on links that are inside paragraphs, as my example showed,
> and (2) the Manual says ATTR_HTML lines are for links:

That's a major change from previous exporter. Now, almost every element,
including paragraphs, can have affiliated keywords at their
beginning. Hence you can write:

  #+attr_latex: something
  - item 1
  - item 2

or

  #+attr_html: something
  Some paragraph.

This means that

  One paragraph.
  #+attr_html: something
  [[link]]
  Second paragraph

is equivalent to:

  One paragraph.

  #+attr_html: something
  [[link]]
  Second paragraph


Now let's have a look at your example.

  #+ATTR_HTML: title="The Org mode homepage" style="color:red;"
  [[http://orgmode.org]]

In this case, the affiliated keyword is attached to the paragraph
containing the link. But _the link can inherit from paragraph's
attributes_.

Since this is not the case yet in, I've added into code base. Is it
working as expected?


I hope I am clearer now.


Regards,

-- 
Nicolas Goaziou

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-08 13:28     ` Nicolas Goaziou
@ 2012-06-08 17:03       ` William Crandall
  2012-06-08 22:37         ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: William Crandall @ 2012-06-08 17:03 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Jambunathan K

Hello Nicolas,

Yes, thanks for explanation and code update.
It works as you describe, as you can see below.

This is a change; now all links within a paragraph
are given (inherit) the same ATTR_HTML.

Is it possible with the new exporter to add ATTR_HTML
attributes to individual link elements?

Thanks again for all your work on this!

-BC

Org-mode: 7.8.11 (release_7.8.11-55-g3f0f87)
Emacs: 24.1.50.1
Windows 7


Org input:
--------------------------------------------------
#+ATTR_HTML: title="The Org mode homepage" style="color:red;"
[[http://orgmode.org]]

#+ATTR_HTML: title="Link hover text"
[[http://www.orgmode.org][This paragraph]]
describes how to use orgmode.

A paragraph about
#+ATTR_HTML: title="Link hover text"
[[./orgmode][org-mode]]
which describes org-e-html...

#+ATTR_HTML: title="Link hover text"
Another paragraph about [[./orgmode][org-mode]] which describes
org-e-html...
--------------------------------------------------

Old:

--------------------------------------------------
<p>
<a href="http://orgmode.org" title="The Org mode homepage"
style="color:red;">http://orgmode.org</a>
</p>
<p>
<a href="http://www.orgmode.org" title="Link hover text">This paragraph</a>
describes how to use orgmode.
</p>
<p>
A paragraph about
<a href="./orgmode" title="Link hover text">org-mode</a>
which describes org-e-html&hellip;
</p>
<p>
Another paragraph about <a href="./orgmode">org-mode</a> which describes
org-e-html&hellip;
</p>
--------------------------------------------------

New:

--------------------------------------------------
<p>
<a href="http://orgmode.org" title="The Org mode homepage"
style="color:red;">http://orgmode.org</a>
</p>

<p>
<a href="http://www.orgmode.org" title="Link hover text">This paragraph</a>
describes how to use orgmode.
</p>

<p>
A paragraph about
</p>
<p>
<a href="./orgmode" title="Link hover text">org-mode</a>
which describes org-e-html&hellip;
</p>

<p>
Another paragraph about <a href="./orgmode" title="Link hover
text">org-mode</a> which describes
org-e-html&hellip;
--------------------------------------------------




On Fri, Jun 8, 2012 at 6:28 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Hello,
>
> William Crandall <bc3141592@gmail.com> writes:
>
>> "ATTR_HTML is only for paragraphs, not links."
>>
>> This puzzles me, because (1) the old exporter works fine
>> on links that are inside paragraphs, as my example showed,
>> and (2) the Manual says ATTR_HTML lines are for links:
>
> That's a major change from previous exporter. Now, almost every element,
> including paragraphs, can have affiliated keywords at their
> beginning. Hence you can write:
>
>  #+attr_latex: something
>  - item 1
>  - item 2
>
> or
>
>  #+attr_html: something
>  Some paragraph.
>
> This means that
>
>  One paragraph.
>  #+attr_html: something
>  [[link]]
>  Second paragraph
>
> is equivalent to:
>
>  One paragraph.
>
>  #+attr_html: something
>  [[link]]
>  Second paragraph
>
>
> Now let's have a look at your example.
>
>  #+ATTR_HTML: title="The Org mode homepage" style="color:red;"
>  [[http://orgmode.org]]
>
> In this case, the affiliated keyword is attached to the paragraph
> containing the link. But _the link can inherit from paragraph's
> attributes_.
>
> Since this is not the case yet in, I've added into code base. Is it
> working as expected?
>
>
> I hope I am clearer now.
>
>
> Regards,
>
> --
> Nicolas Goaziou

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-08 17:03       ` William Crandall
@ 2012-06-08 22:37         ` Nicolas Goaziou
  2012-06-08 23:53           ` William Crandall
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2012-06-08 22:37 UTC (permalink / raw)
  To: William Crandall; +Cc: emacs-orgmode, Jambunathan K

Hello,

William Crandall <bc3141592@gmail.com> writes:

> This is a change; now all links within a paragraph
> are given (inherit) the same ATTR_HTML.

Indeed.

> Is it possible with the new exporter to add ATTR_HTML
> attributes to individual link elements?

No, it isn't possible to control individual link elements with
affiliated keywords.


Regards,

-- 
Nicolas Goaziou

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-08 22:37         ` Nicolas Goaziou
@ 2012-06-08 23:53           ` William Crandall
  2012-06-09 13:54             ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: William Crandall @ 2012-06-08 23:53 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Jambunathan K

Ah, that is a pity.

Seems like a step back, in allowable specificity.
As it was possible in the old.

You mentioned before using "filters." I take it these
are the ones described in org-export-filters.el (line 1775),
"The Filter System."

Has anyone written up any worked examples of these?

And, is that the best tool for adding attributes to links?

Thanks again,

-BC

On Fri, Jun 8, 2012 at 3:37 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Hello,
>
> William Crandall <bc3141592@gmail.com> writes:
>
>> This is a change; now all links within a paragraph
>> are given (inherit) the same ATTR_HTML.
>
> Indeed.
>
>> Is it possible with the new exporter to add ATTR_HTML
>> attributes to individual link elements?
>
> No, it isn't possible to control individual link elements with
> affiliated keywords.
>
>
> Regards,
>
> --
> Nicolas Goaziou

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-08 23:53           ` William Crandall
@ 2012-06-09 13:54             ` Nicolas Goaziou
  2012-06-10  1:43               ` William Crandall
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2012-06-09 13:54 UTC (permalink / raw)
  To: William Crandall; +Cc: emacs-orgmode, Jambunathan K

Hello,

William Crandall <bc3141592@gmail.com> writes:

> You mentioned before using "filters." I take it these are the ones
> described in org-export-filters.el (line 1775), "The Filter System."
> Has anyone written up any worked examples of these?

org-e-ascii.el and org-e-html.el both use filters.  Also, I posted a few
examples on this list while answering to requests from users.

> And, is that the best tool for adding attributes to links?

Besides your canonical example, I don't know exactly what are your
needs. Hence, it may be, but that's hard to tell.

Filters are meant to modify output from transcoders (so you're working
with HTML, or LaTeX, or... material) before it is concatenated into
global result.  They allow the user to have the last word in any
situation.

You can also define your own transcoders if you prefer to work on parsed
data.

Now, if the attributes you want to add have no pattern with regards to
related link, you cannot do much programmatically and you'll have to
insert HTML code manually.

Also, besides code comments, you may have a look at:

  http://orgmode.org/worg/dev/org-export-reference.html


Regards,

-- 
Nicolas Goaziou

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-09 13:54             ` Nicolas Goaziou
@ 2012-06-10  1:43               ` William Crandall
  2012-06-14  9:51                 ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: William Crandall @ 2012-06-10  1:43 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Jambunathan K

Hello Nicolas,

Many thanks for explaining the logic and functionality
of the new exporter.

I confess I am puzzled by the choice to drop the ability
to apply attributes to links.

The use case I'm aiming for is a standard HTML feature:

   3.2.3.2 The 'title' attribute

   The title attribute represents advisory information for the
   element, such as would be appropriate for a tooltip. On a link,
   this could be the title or a description of the target resource;
   on an image, it could be the image credit or a description of
   the image; on a paragraph, it could be a footnote or commentary
   on the text; on a citation, it could be further information
   about the source; and so forth.

http://www.w3.org/TR/html5/global-attributes.html#the-title-attribute


In org-e-html today, it is only possible to attach a unique
attribute to a paragraph; all links within that paragraph
inherit its attributes. If a paragraph contains two links,
they are both forced to show the same tooltip.

The old exporter allowed this specificity, correctly
interleaving link and image titles in one paragraph:

Org input:
--------------------------------------------------
A paragraph with three papers, and an image:
#+ATTR_HTML: title="Paper #1"
[[./local/01.html][a first paper]]
followed by
#+ATTR_HTML: title="Paper #2"
[[./local/02.html][a second paper]]
which describe stuff. It then offers a cat
#+ATTR_HTML: title="Some cats" alt="Cat image"
[[./local/cats.png]]
and finally a third, PDF paper
#+ATTR_HTML: title="Paper #3"
[[./local/03.pdf][a third paper]]
--------------------------------------------------

Old exporter:
--------------------------------------------------
<p>
A paragraph with three papers, and an image:
<a href="./local/01.html" title="Paper #1">a first paper</a>
followed by
<a href="./local/02.html" title="Paper #2">a second paper</a>
which describe stuff. It then offers a cat
<img src="./local/cats.png" title="Some cats" alt="Cat image" />
and finally a third, PDF paper
<a href="./local/03.pdf" title="Paper #3">a third paper</a>
</p>
--------------------------------------------------


I believe that this ability, this specificity within
paragraphs, is generally quite useful, and I hope that
you will consider it for the new exporter.

If I'm missing something, if there /is/ a way to add
individual link attributes, please let me know.

It doesn't sound like filters allow that.

Thanks again, for building and explaining.

-BC

Org-mode version 7.8.11 (release_7.8.11-64-g168c83)
GNU Emacs 24.1.50.1 (i386-mingw-nt6.1.7601)
Windows 7

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

* Re: org-e-html: Including ATTR_HTML: title="hover text"
  2012-06-10  1:43               ` William Crandall
@ 2012-06-14  9:51                 ` Nicolas Goaziou
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2012-06-14  9:51 UTC (permalink / raw)
  To: William Crandall; +Cc: emacs-orgmode, Jambunathan K

Hello,


William Crandall <bc3141592@gmail.com> writes:

> I confess I am puzzled by the choice to drop the ability
> to apply attributes to links.

That's not a choice /per se/, merely an annoying side-effect of moving
to an overall better paradigm.

> Org input:
> --------------------------------------------------
> A paragraph with three papers, and an image:
> #+ATTR_HTML: title="Paper #1"
> [[./local/01.html][a first paper]]
> followed by
> #+ATTR_HTML: title="Paper #2"
> [[./local/02.html][a second paper]]
> which describe stuff. It then offers a cat
> #+ATTR_HTML: title="Some cats" alt="Cat image"
> [[./local/cats.png]]
> and finally a third, PDF paper
> #+ATTR_HTML: title="Paper #3"
> [[./local/03.pdf][a third paper]]
> --------------------------------------------------
>
> Old exporter:
> --------------------------------------------------
> <p>
> A paragraph with three papers, and an image:
> <a href="./local/01.html" title="Paper #1">a first paper</a>
> followed by
> <a href="./local/02.html" title="Paper #2">a second paper</a>
> which describe stuff. It then offers a cat
> <img src="./local/cats.png" title="Some cats" alt="Cat image" />
> and finally a third, PDF paper
> <a href="./local/03.pdf" title="Paper #3">a third paper</a>
> </p>
> --------------------------------------------------
>
>
> I believe that this ability, this specificity within
> paragraphs, is generally quite useful, and I hope that
> you will consider it for the new exporter.

I understand your problem, but inserting ATTR_HTML keywords in
a paragraph isn't possible anymore.  I cannot allow that as it would
defeat a fundamental change in the new Org syntax.

Though, I'm open to any other suggestion.  For example, link's syntax
could be extended to allow attributes, much like Babel's inline source
blocks or calls.  It would probably require many changes to core,
though.

ATTR_HTML could also accept a list of properties that would be applied
in order to each link in the paragraph.  But it wouldn't scale well with
a large number of links.

I'm certain there are better solutions out there.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2012-06-14  9:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-07  2:08 org-e-html: Including ATTR_HTML: title="hover text" William Crandall
2012-06-07  2:59 ` William Crandall
2012-06-07 19:28 ` Nicolas Goaziou
2012-06-07 22:26   ` William Crandall
2012-06-08 13:28     ` Nicolas Goaziou
2012-06-08 17:03       ` William Crandall
2012-06-08 22:37         ` Nicolas Goaziou
2012-06-08 23:53           ` William Crandall
2012-06-09 13:54             ` Nicolas Goaziou
2012-06-10  1:43               ` William Crandall
2012-06-14  9:51                 ` Nicolas Goaziou

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).