emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question Regarding Creating HTML Style Buttons With Org Mode


From: Juan Manuel Macías
Subject: Re: Question Regarding Creating HTML Style Buttons With Org Mode
Date: Sat, 19 Feb 2022 09:51:37 +0000

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

[Prev in Thread] Current Thread [Next in Thread]