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: Samuel Banya
Subject: Re: Question Regarding Creating HTML Style Buttons With Org Mode
Date: Tue, 22 Feb 2022 21:25:20 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-4778-g14fba9972e-fm-20220217.001-g14fba997

Hey Juan,

Just wanted to let you know that this works beautifully!

I wish I was as good at Elisp to make this in the first place, but this really helps since I wanted to have some minimum overhead for 2 separate websites to be able to just write in Org Mode but include ideas for buttons, with classes and ID values.

This helps a ton, thanks so much as it totally worked! :)

Sincerely,

Sam

On Sun, Feb 20, 2022, at 7:38 PM, Samuel Banya wrote:
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

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