From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Davis Subject: Re: Getting checkboxes in HTML output? Date: Thu, 28 Nov 2013 08:55:50 -0500 Message-ID: <52974B66.5030109@pfdstudio.com> References: <20131127154534.GA12765@pdavismbp15.iscinternal.com> <8738mhal2d.fsf@alphaville.bos.redhat.com> <20131127182059.GB12765@pdavismbp15.iscinternal.com> <20131128133329.GA28945@eyeBook> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm24T-0007QZ-D9 for emacs-orgmode@gnu.org; Thu, 28 Nov 2013 08:56:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vm24O-0003re-6Q for emacs-orgmode@gnu.org; Thu, 28 Nov 2013 08:55:57 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:57030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm24N-0003rT-Um for emacs-orgmode@gnu.org; Thu, 28 Nov 2013 08:55:52 -0500 In-Reply-To: <20131128133329.GA28945@eyeBook> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 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 "[X]") >>> (off "[ ]") >>> (trans "[-]") >>> (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 "") >> (off "") >> (trans "[-]") >> (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