emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] html checkbox output


From: Nicolas Goaziou
Subject: Re: [O] html checkbox output
Date: Fri, 06 Dec 2013 23:37:50 +0100

Hello,

Rick Frankel <address@hidden> 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 
"\\`.*\\(<code>\\[\\(X\\|&#xa0;\\|-\\)\\]</code>\\).*$"
                                (lambda (rep)
                                  (let ((check (match-string 2 rep)))
                                    (cond ((equal check "X") "&#x2611;")
                                          ((equal check "-") "&#x2610;")
                                          (t "&#x2610;"))))
                                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






reply via email to

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