emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Samuel Banya" <sbanya@fastmail.com>
To: "Charles Berry" <emacs-orgmode@gnu.org>
Subject: Re: Question Regarding Creating HTML Style Buttons With Org Mode
Date: Tue, 22 Feb 2022 21:25:20 -0500	[thread overview]
Message-ID: <00855af6-edb5-4705-9222-dba6503e1861@www.fastmail.com> (raw)
In-Reply-To: <8bb3b1e9-ff36-45a6-9eb2-811b38d5aea8@www.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2915 bytes --]

  reply	other threads:[~2022-02-23  2:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 14:56 Question Regarding Creating HTML Style Buttons With Org Mode Samuel Banya
2022-02-17 22:10 ` Juan Manuel Macías
2022-02-18 19:59   ` Samuel Banya
2022-02-18 20:04     ` Samuel Banya
2022-02-18 20:38     ` Juan Manuel Macías
2022-02-18 20:51       ` Juan Manuel Macías
2022-02-19  1:02         ` Samuel Banya
2022-02-19  9:41           ` Juan Manuel Macías
2022-02-19  9:51             ` Juan Manuel Macías
2022-02-21  0:38               ` Samuel Banya
2022-02-23  2:25                 ` Samuel Banya [this message]
2022-02-23  2:33                   ` Juan Manuel Macías

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00855af6-edb5-4705-9222-dba6503e1861@www.fastmail.com \
    --to=sbanya@fastmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).