Thanks for this, will try this for my Emacs config.

On Sat, Feb 19, 2022, at 4:51 AM, Juan Manuel Macías wrote:
> Juan Manuel Macías writes:
> 
> > If you want to pass the class or id 'manually' to each link, and thus
> > have more control, you can evaluate this other version, where the class
> > or id would be added at the end of the link description, after (for
> > example) "!style":
> 
> PS: Sorry, this is the correct code:
> 
>   (org-link-set-parameters "button"
>    :face '(:foreground "green4" :underline t)
>    :follow (lambda (path) (browse-url path))
>    :export (lambda (path desc backend)
>      (when (eq backend 'html)
>        (let ((style (if (string-match "\\(!style\\)\\(.+\\)" desc)
> (match-string 2 desc)
>        ""))
>       (desc (replace-regexp-in-string "\\(!style .+\\)" "" desc)))
> (format "<form><button %s
>    formaction=\"%s\">%s</button></form>" style
>    path desc)))))
> 
> 
> Example:
> 
> [[button:http://www.sambanya.com/artgallery.html][Art Gallery Page Link 
> !style class="mybutton"]]
> 
> == HTML ==>
> 
> <p>
> <form><button  class="mybutton" 
> formaction="http://www.sambanya.com/artgallery.html";>Art Gallery Page Link 
> </button></form>
> </p>
> 
> 

Reply via email to