emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] manual: confusing example of adding attributes to a link (affiliated keywords)
@ 2022-06-20 16:25 Max Nikulin
  2022-06-25  5:29 ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Max Nikulin @ 2022-06-20 16:25 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Org Manual in info "(org) Links in HTML export" 
https://orgmode.org/manual/Links-in-HTML-export.html has the following 
example:

> Org files can also have special directives to the HTML export
> back-end. For example, by using ‘#+ATTR_HTML’ lines to specify new
> format attributes to <a> or <img> tags. This example shows changing
> the link’s title and style:
> 
> #+ATTR_HTML: :title The Org mode homepage :style color:red;
> [[https://orgmode.org]]

Likely I have seen similar suggestions in this list as well.

Actually it assigns attribute to paragraphs in addition to links. That 
is why, I think, this fragment should be removed from manual as a 
confusing one since it gives impression of support of per-link attributes.

Attributes assigned through affiliated keywords belongs to paragraph 
(block-level element), not to link (inline object). Actual result of export:

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

If it were possible to set attributes to links, the result should be

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

The reason of my expectation is that a paragraph may have more than one 
link with different titles.

I am unsure if formal bug report will help. I promised it in the 
following discussion:
Max Nikulin to emacs-orgmode. Re: Org-syntax: Intra-word markup. Thu, 3 
Feb 2022 19:10:19 +0700. https://list.orgmode.org/stggnf$d8g$1@ciao.gmane.io

A similar complain:
Anton Linevych. How to add extra attributes to link in Org-mode? 
2017-06-21 https://linevi.ch/en/org-link-extra-attrs.html

The reason why I have decided to post this bug report now is the 
following message:
Juan Manuel Macías to emacs-orgmode. Re: About 'inline special blocks' 
Sun, 19 Jun 2022 12:47:40 +0000. 
https://list.orgmode.org/875ykwvmz7.fsf@posteo.net

It states that styles and similar stuff may solve the issue with 
attributes for inline objects. From my point of view it is wrong and in 
some cases per-object attributes are necessary. While <a rel="nofollow 
noreferrer" href="..."> or <a target="_blank" href="..."> may be added 
through style, attributes like "alt" for images, "title", "lang", etc. 
for links are individual.

I am aware of the following post:
J. Kitchin. Extending the org-mode link syntax with attributes. 
2015-02-05 
http://kitchingroup.cheme.cmu.edu/blog/2015/02/05/Extending-the-org-mode-link-syntax-with-attributes/
The recipe solves the problem, but this time the topic of inline special 
blocks has been risen in the context of limitations in Org markup making 
it inappropriate tool for GNU manuals in general and the Org manual in 
particular. So some more general solution is required than local 
customization.

So as outcome for this bug report I expect that either caveats related 
to affiliated keywords are clearly stated in the manual or some 
"official" way to assign attributes for specific inline objects is 
introduced.



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

* Re: [BUG] manual: confusing example of adding attributes to a link (affiliated keywords)
  2022-06-20 16:25 [BUG] manual: confusing example of adding attributes to a link (affiliated keywords) Max Nikulin
@ 2022-06-25  5:29 ` Ihor Radchenko
  2022-06-25 10:12   ` Max Nikulin
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-06-25  5:29 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> Org Manual in info "(org) Links in HTML export" 
> https://orgmode.org/manual/Links-in-HTML-export.html has the following 
> example:
>
>> Org files can also have special directives to the HTML export
>> back-end. For example, by using ‘#+ATTR_HTML’ lines to specify new
>> format attributes to <a> or <img> tags. This example shows changing
>> the link’s title and style:
>> 
>> #+ATTR_HTML: :title The Org mode homepage :style color:red;
>> [[https://orgmode.org]]
>
> Likely I have seen similar suggestions in this list as well.
>
> Actually it assigns attribute to paragraphs in addition to links. That 
> is why, I think, this fragment should be removed from manual as a 
> confusing one since it gives impression of support of per-link attributes.

Could we clarify that the attributes will apply to the paragraph instead?

> It states that styles and similar stuff may solve the issue with 
> attributes for inline objects. From my point of view it is wrong and in 
> some cases per-object attributes are necessary. While <a rel="nofollow 
> noreferrer" href="..."> or <a target="_blank" href="..."> may be added 
> through style, attributes like "alt" for images, "title", "lang", etc. 
> for links are individual.

You examples are pretty much dedicated to html. Do you know if
per-object attributes could be actually useful for other export
backends?

Best,
Ihor


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

* Re: [BUG] manual: confusing example of adding attributes to a link (affiliated keywords)
  2022-06-25  5:29 ` Ihor Radchenko
@ 2022-06-25 10:12   ` Max Nikulin
  2022-06-25 10:39     ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Max Nikulin @ 2022-06-25 10:12 UTC (permalink / raw)
  To: emacs-orgmode

On 25/06/2022 12:29, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
>>> #+ATTR_HTML: :title The Org mode homepage :style color:red;
>>> [[https://orgmode.org]]
>>
>> Likely I have seen similar suggestions in this list as well.
>>
>> Actually it assigns attribute to paragraphs in addition to links. That
>> is why, I think, this fragment should be removed from manual as a
>> confusing one since it gives impression of support of per-link attributes.
> 
> Could we clarify that the attributes will apply to the paragraph instead?

While paragraph is short, title is just redundant. When it contains a 
lot of text, the link title duplicated as a paragraph attribute becomes 
misleading since the title is applicable to link text only. When there 
are more than one object, it is impossible to set different titles to 
links or mark rel="noreferrer nofollow" only one link, keeping other as 
regular ones.

Certainly it is possible to document that attributes are mostly useful 
for image links when they are block-level elements rather than inline 
objects. Caveats of trying to use attributes for inline objects should 
be clearly stated to avoid false expectation of supported feature.

>> It states that styles and similar stuff may solve the issue with
>> attributes for inline objects. From my point of view it is wrong and in
>> some cases per-object attributes are necessary. While <a rel="nofollow
>> noreferrer" href="..."> or <a target="_blank" href="..."> may be added
>> through style, attributes like "alt" for images, "title", "lang", etc.
>> for links are individual.
> 
> You examples are pretty much dedicated to html. Do you know if
> per-object attributes could be actually useful for other export
> backends?

The following example is somewhat contrived. Try to set different 
options (width or e.g. angle) for several inline images. It applies to 
LaTeX as well:


     #+attr_latex: :center nil :options angle=30 :width 16mm
     [[file:/usr/share/icons/hicolor/48x48/apps/emacs.png]]
     and
     [[file:/usr/share/icons/hicolor/48x48/apps/emacs.png]]
     # second one should have angle=-30



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

* Re: [BUG] manual: confusing example of adding attributes to a link (affiliated keywords)
  2022-06-25 10:12   ` Max Nikulin
@ 2022-06-25 10:39     ` Ihor Radchenko
  2022-06-25 11:55       ` Max Nikulin
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-06-25 10:39 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> Certainly it is possible to document that attributes are mostly useful 
> for image links when they are block-level elements rather than inline 
> objects. Caveats of trying to use attributes for inline objects should 
> be clearly stated to avoid false expectation of supported feature.

Agree. Patches are welcome :)

>> You examples are pretty much dedicated to html. Do you know if
>> per-object attributes could be actually useful for other export
>> backends?
>
> The following example is somewhat contrived. Try to set different 
> options (width or e.g. angle) for several inline images. It applies to 
> LaTeX as well:
>
>
>      #+attr_latex: :center nil :options angle=30 :width 16mm
>      [[file:/usr/share/icons/hicolor/48x48/apps/emacs.png]]
>      and
>      [[file:/usr/share/icons/hicolor/48x48/apps/emacs.png]]
>      # second one should have angle=-30

What about something that is not a single-image paragraph?
Single-image paragraphs specifically are handled specially during
export.

Best,
Ihor


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

* Re: [BUG] manual: confusing example of adding attributes to a link (affiliated keywords)
  2022-06-25 10:39     ` Ihor Radchenko
@ 2022-06-25 11:55       ` Max Nikulin
  2022-06-25 12:17         ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Max Nikulin @ 2022-06-25 11:55 UTC (permalink / raw)
  To: emacs-orgmode

On 25/06/2022 17:39, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
>> The following example is somewhat contrived. Try to set different
>> options (width or e.g. angle) for several inline images. It applies to
>> LaTeX as well:
>>
>>       #+attr_latex: :center nil :options angle=30 :width 16mm
>>       [[file:/usr/share/icons/hicolor/48x48/apps/emacs.png]]
>>       and
>>       [[file:/usr/share/icons/hicolor/48x48/apps/emacs.png]]
>>       # second one should have angle=-30
> 
> What about something that is not a single-image paragraph?
> Single-image paragraphs specifically are handled specially during
> export.

Ihor, I am sorry, but your question is unclear to me. I specially 
suppressed center environment and made images small enough to fit them 
into a single line of a paragraph. It is the case when limitations of 
attributes (as they can be currently set) are prominent.



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

* Re: [BUG] manual: confusing example of adding attributes to a link (affiliated keywords)
  2022-06-25 11:55       ` Max Nikulin
@ 2022-06-25 12:17         ` Ihor Radchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Ihor Radchenko @ 2022-06-25 12:17 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> On 25/06/2022 17:39, Ihor Radchenko wrote:
>> Max Nikulin writes:
>> 
>>> The following example is somewhat contrived. Try to set different
>>> options (width or e.g. angle) for several inline images. It applies to
>>> LaTeX as well:
>>>
>>>       #+attr_latex: :center nil :options angle=30 :width 16mm
>>>       [[file:/usr/share/icons/hicolor/48x48/apps/emacs.png]]
>>>       and
>>>       [[file:/usr/share/icons/hicolor/48x48/apps/emacs.png]]
>>>       # second one should have angle=-30
>> 
>> What about something that is not a single-image paragraph?
>> Single-image paragraphs specifically are handled specially during
>> export.
>
> Ihor, I am sorry, but your question is unclear to me. I specially 
> suppressed center environment and made images small enough to fit them 
> into a single line of a paragraph. It is the case when limitations of 
> attributes (as they can be currently set) are prominent.

Sorry, I misread your example.
I agree that in-paragraph images are indeed problematic with our current
syntax.

Best,
Ihor


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

end of thread, other threads:[~2022-06-25 12:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20 16:25 [BUG] manual: confusing example of adding attributes to a link (affiliated keywords) Max Nikulin
2022-06-25  5:29 ` Ihor Radchenko
2022-06-25 10:12   ` Max Nikulin
2022-06-25 10:39     ` Ihor Radchenko
2022-06-25 11:55       ` Max Nikulin
2022-06-25 12:17         ` Ihor Radchenko

Code repositories for project(s) associated with this 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).