From: Peter Davis <pfd@pfdstudio.com>
To: emacs-orgmode@gnu.org
Subject: Re: Getting checkboxes in HTML output?
Date: Thu, 28 Nov 2013 08:55:50 -0500 [thread overview]
Message-ID: <52974B66.5030109@pfdstudio.com> (raw)
In-Reply-To: <20131128133329.GA28945@eyeBook>
On 11/28/13, 8:33 AM, Rick Frankel wrote:
> On Wed, Nov 27, 2013 at 01:20:59PM -0500, Peter Davis wrote:
>> On Wed, Nov 27, 2013 at 11:03:38AM -0500, Nick Dokos wrote:
>>> Peter Davis <pfd@pfdstudio.com> writes:
>>>
>>>> I noticed that HTML output contains "[ ]" and "[X]", just like
>> the
>>>> mark-up. Wouldn't it make sense to use actual unchecked or
>> checked
>>>> checkboxes in HTML?
>>>>
>>>> Is there a simple way to do this that I've overlooked?
>>>>
>>> A cursory glance through ox-html.el uncovered this:
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> (defun org-html-checkbox (checkbox)
>>> "Format CHECKBOX into HTML."
>>> (case checkbox (on "<code>[X]</code>")
>>> (off "<code>[ ]</code>")
>>> (trans "<code>[-]</code>")
>>> (t "")))
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> Maybe you can redefine this function to do what you want?
>> Yes, this works:
>>
>> --8<---------------cut here---------------start------------->8---
>> (defun org-html-checkbox (checkbox)
>> "Format CHECKBOX into HTML."
>> (case checkbox (on "<input type=\"checkbox\" checked />")
>> (off "<input type=\"checkbox\" />")
>> (trans "<code>[-]</code>")
>> (t "")))
>> --8<---------------cut here---------------end--------------->8---
> For xhtml compatibility, it would need to be 'checked="checked"'. I've
> done a quick look at the html dtd, and i does look like input elements
> are allowed outside of forms, but i would need to double
> check... Also, the fallback to "[-]" for the partially checked state
> is a bit inconsistent, perhaps changing background color or other
> attributre of the checkbox would be better.
>
> I would be willing to make this change (as an option?) to the html
> exporter if others agree.
Thanks, Rick. Adding a value for the checked attribute is no problem. I
didn't have a good solution for the partially checked state. One
possibility would be adding the 'disabled="disabled"' attribute, which
would make it appear gray. However, I've considered adding that
attribute in all cases, since the HTML output is really for display and
not input.
I'd love to see this as an option in the main code, so I don't have to
keep retrofitting it into succeeding versions.
-pd
--
----
Peter Davis
The Tech Curmudgeon
www.techcurmudgeon.com
next prev parent reply other threads:[~2013-11-28 13:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-27 15:45 Getting checkboxes in HTML output? Peter Davis
2013-11-27 16:03 ` Nick Dokos
2013-11-27 18:20 ` Peter Davis
2013-11-28 13:33 ` Rick Frankel
2013-11-28 13:55 ` Peter Davis [this message]
2013-11-28 16:08 ` Bastien
2013-11-28 17:03 ` Matt Price
2013-11-28 20:51 ` Achim Gratz
2013-11-28 21:26 ` Sebastien Vauban
[not found] ` <CAN_Dec9a5v2rqQSvAKpvgLWKsTY8YLoMSvKbtkgak77Bb=nbAg@mail.gmail.com>
2013-11-28 21:58 ` Matt Price
2013-11-29 16:11 ` Rick Frankel
2013-11-29 18:59 ` Peter Davis
2013-11-30 6:54 ` Carsten Dominik
2013-11-30 14:07 ` Rick Frankel
2013-12-01 6:46 ` Carsten Dominik
2013-12-02 8:44 ` Sebastien Vauban
2013-12-02 16:38 ` Peter Davis
2013-12-03 1:11 ` Nick Dokos
2013-12-03 12:29 ` Peter Davis
2013-12-03 15:03 ` Rick Frankel
2013-12-03 15:24 ` Sebastien Vauban
2013-12-03 16:56 ` Peter Davis
2013-12-03 15:14 ` Rick Frankel
2013-11-29 1:47 ` Eric Abrahamsen
2013-11-28 14:30 ` Waldemar Quevedo
2013-11-28 14:41 ` Waldemar Quevedo
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=52974B66.5030109@pfdstudio.com \
--to=pfd@pfdstudio.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).