From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: html checkbox output Date: Fri, 06 Dec 2013 23:37:50 +0100 Message-ID: <87siu5txkx.fsf@gmail.com> References: <20131206215321.GA48654@eyeBook> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp41h-0005sb-9x for emacs-orgmode@gnu.org; Fri, 06 Dec 2013 17:37:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vp41b-0006y4-E8 for emacs-orgmode@gnu.org; Fri, 06 Dec 2013 17:37:37 -0500 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:43970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp41b-0006xq-6v for emacs-orgmode@gnu.org; Fri, 06 Dec 2013 17:37:31 -0500 Received: by mail-wi0-f172.google.com with SMTP id en1so1553665wid.17 for ; Fri, 06 Dec 2013 14:37:30 -0800 (PST) Received: from selenimh ([91.224.148.150]) by mx.google.com with ESMTPSA id je17sm35231wic.4.2013.12.06.14.37.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Dec 2013 14:37:29 -0800 (PST) In-Reply-To: <20131206215321.GA48654@eyeBook> (Rick Frankel's message of "Fri, 6 Dec 2013 16:53:21 -0500") 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 Hello, Rick Frankel writes: > So, here's a patch I would like a couple of people to try before i > commit it. It provides customization of checkbox formatting for html > output (unicode, ascii, checkbox input fields or custom). I couldn't > figure out how to add an association list customization with preset > options to a customization choice, so the custom option is a > partilally pre-filled sexp. > > The default is still ascii, partially so that the checkbox tests don't > fail w/o being changed. > > Let me know if this works for every of if it is too complex a solution > befor I apply it to master. A new buffer keyword (which needs to be documented in org.texi), a defcustom with a completely free sexp... Isn't it a bit too much for mere checkboxes? Filters provide almost the same functionality: (defun my-checkbox-filter (item backend info) (when (org-export-derived-backend-p backend 'html) (replace-regexp-in-string "\\`.*\\(\\[\\(X\\| \\|-\\)\\]\\).*$" (lambda (rep) (let ((check (match-string 2 rep))) (cond ((equal check "X") "☑") ((equal check "-") "☐") (t "☐")))) item nil nil 1))) (add-to-list 'org-export-filter-item-functions 'my-checkbox-filter) Anyway, here are a few comments. > +(defcustom org-html-checkbox-type "ascii" > + "The type of checkboxes to use for html export. See First line of a docstring has to be a single complete sentence. > +(defun org-html-checkbox (checkbox info) > + "Format CHECKBOX into HTML. This can be overriden on a Ditto. > + (cdr > + (assoc checkbox (assq checkbox > + (if (listp checkboxes) checkboxes > + (if (string-equal (substring checkboxes 0 1) "(") (if (eq (aref checkboxes 0) ?\() > + (read checkboxes) This looks cheesy. `read'? Do you really want to parse arbitrary Sexps? Regards, -- Nicolas Goaziou