emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to tell `org-html-link' to create a link with some HTML class?
@ 2023-06-20  4:42 Marcin Borkowski
  2023-06-20  6:07 ` Jens Lechtenboerger
  2023-06-20 16:30 ` Max Nikulin
  0 siblings, 2 replies; 5+ messages in thread
From: Marcin Borkowski @ 2023-06-20  4:42 UTC (permalink / raw)
  To: Org-Mode mailing list

Dear Orgers,

as I mentioned some time ago, I'm writing a custom exporter (actually,
a very thin wrapper around the HTML exporter).  I'd like `org-html-link'
to add some class to the links it generates.  Is that possible?

TIA,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to tell `org-html-link' to create a link with some HTML class?
  2023-06-20  4:42 How to tell `org-html-link' to create a link with some HTML class? Marcin Borkowski
@ 2023-06-20  6:07 ` Jens Lechtenboerger
  2023-06-20 15:20   ` Marcin Borkowski
  2023-06-20 16:30 ` Max Nikulin
  1 sibling, 1 reply; 5+ messages in thread
From: Jens Lechtenboerger @ 2023-06-20  6:07 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

On 2023-06-20, Marcin Borkowski wrote:

> Dear Orgers,
>
> as I mentioned some time ago, I'm writing a custom exporter (actually,
> a very thin wrapper around the HTML exporter).  I'd like `org-html-link'
> to add some class to the links it generates.  Is that possible?

Dear Marcin,

yes, that’s possible, ":attr_html" is read in `org-html-link'.  You
have to set that in your code, see [1] for an example for classes in
my reveal.js backend.

Briefly, with `elem' being the link, I use this:
`(org-element-put-property elem :attr_html (list newattrs))'

Best wishes
Jens

[1] https://gitlab.com/oer/org-re-reveal/-/blob/master/org-re-reveal.el#L2167


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

* Re: How to tell `org-html-link' to create a link with some HTML class?
  2023-06-20  6:07 ` Jens Lechtenboerger
@ 2023-06-20 15:20   ` Marcin Borkowski
  0 siblings, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2023-06-20 15:20 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Org-Mode mailing list


On 2023-06-20, at 08:07, Jens Lechtenboerger <lechten@wi.uni-muenster.de> wrote:

> On 2023-06-20, Marcin Borkowski wrote:
>
>> Dear Orgers,
>>
>> as I mentioned some time ago, I'm writing a custom exporter (actually,
>> a very thin wrapper around the HTML exporter).  I'd like `org-html-link'
>> to add some class to the links it generates.  Is that possible?
>
> Dear Marcin,
>
> yes, that’s possible, ":attr_html" is read in `org-html-link'.  You
> have to set that in your code, see [1] for an example for classes in
> my reveal.js backend.
>
> Briefly, with `elem' being the link, I use this:
> `(org-element-put-property elem :attr_html (list newattrs))'
>
> Best wishes
> Jens
>
> [1] https://gitlab.com/oer/org-re-reveal/-/blob/master/org-re-reveal.el#L2167

Great, it worked!  Though not at first – I had to experiment a bit to
find the right invocation:

(org-element-put-property link :attr_html (list ":class" "external"))

which was not obvious for me.

Thanks,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to tell `org-html-link' to create a link with some HTML class?
  2023-06-20  4:42 How to tell `org-html-link' to create a link with some HTML class? Marcin Borkowski
  2023-06-20  6:07 ` Jens Lechtenboerger
@ 2023-06-20 16:30 ` Max Nikulin
  2023-06-21 19:17   ` Marcin Borkowski
  1 sibling, 1 reply; 5+ messages in thread
From: Max Nikulin @ 2023-06-20 16:30 UTC (permalink / raw)
  To: emacs-orgmode

On 20/06/2023 11:42, Marcin Borkowski wrote:
> 
> as I mentioned some time ago, I'm writing a custom exporter (actually,
> a very thin wrapper around the HTML exporter).  I'd like `org-html-link'
> to add some class to the links it generates.  Is that possible?

I do not have a ready to use recipe. Some links to mailing list threads:

https://list.orgmode.org/t8q71r$mgv$1@ciao.gmane.io/
Max Nikulin. [BUG] manual: confusing example of adding attributes to a 
link (affiliated keywords) Mon, 20 Jun 2022 23:25:29 +0700

Unfortunately

#+attr_html: :class something

adds class to the whole following paragraph as well. Notice a link to a 
John Kitchin blog post. Another thread with the same link:

https://list.orgmode.org/87im8k3be8.fsf@posteo.net/
Juan Manuel Macías. Re: [tip] Export subfigures to LaTeX (and HTML). 
Tue, 29 Dec 2020 16:00:31 +0100

I have not tried to implement an idea with a parse-tree export filter 
that transfers attributes from links having a custom type to following 
objects (Ihor is against such approach):

Max Nikulin. Re: About 'inline special blocks' Tue, 24 May 2022 22:09:33 
+0700. https://list.orgmode.org/t6isfe$c50$1@ciao.gmane.io




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

* Re: How to tell `org-html-link' to create a link with some HTML class?
  2023-06-20 16:30 ` Max Nikulin
@ 2023-06-21 19:17   ` Marcin Borkowski
  0 siblings, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2023-06-21 19:17 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode


On 2023-06-20, at 18:30, Max Nikulin <manikulin@gmail.com> wrote:

> On 20/06/2023 11:42, Marcin Borkowski wrote:
>> as I mentioned some time ago, I'm writing a custom exporter
>> (actually,
>> a very thin wrapper around the HTML exporter).  I'd like `org-html-link'
>> to add some class to the links it generates.  Is that possible?
>
> I do not have a ready to use recipe. Some links to mailing list threads:
>
> [...]

Thanks.  My use case is a bit different – I explicitly do not want to
mark these links in the Org file, but I want my custom exporter to add
some class to "external" links.  (Yes, I am coding yet another blogging
platform on top of Org mode – but I believe it has some novel aspects;
I did review the existing options and none of them seems to do what
I want.)

Thanks anyway,

-- 
Marcin Borkowski
http://mbork.pl


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

end of thread, other threads:[~2023-06-21 19:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-20  4:42 How to tell `org-html-link' to create a link with some HTML class? Marcin Borkowski
2023-06-20  6:07 ` Jens Lechtenboerger
2023-06-20 15:20   ` Marcin Borkowski
2023-06-20 16:30 ` Max Nikulin
2023-06-21 19:17   ` Marcin Borkowski

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