[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: |
Mon, 06 Jan 2014 12:10:35 +0100 |
Hello,
Bastien <address@hidden> writes:
> Hi Nicolas and Rick,
>
> Nicolas Goaziou <address@hidden> writes:
>
>> 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?
>
> Personally I think the defcustom is enough, as this choice is likely
> to be made for all Org documents.
>
>> 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\\| \\|-\\)\\]</code>\\).*$"
>> (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)
>
> Yes, but a defcustom would be easier.
As long as it doesn't let you write completely free sexps. Otherwise,
a function is equally complex.
Regards,
--
Nicolas Goaziou