From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Feature request: lists with letters Date: Mon, 13 Feb 2017 17:55:23 +0100 Message-ID: <87vaseni84.fsf@gmx.us> References: <1622a63fda844eb1aa553fdcd19a5758@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> <87d1ezwiq0.fsf@pinto.chemeng.ucl.ac.uk> <87efzfbd47.fsf@posteo.de> <874m0772pn.fsf@gmx.us> <87mvdzm6o7.fsf@posteo.de> <87y3xfn243.fsf@gmx.us> <87r336mhvy.fsf@posteo.de> <87mvdtr098.fsf@nicolasgoaziou.fr> <8760kepdml.fsf@gmx.us> <87shnip5he.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdJur-0007Ei-Ip for emacs-orgmode@gnu.org; Mon, 13 Feb 2017 11:55:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdJuo-00056X-AD for emacs-orgmode@gnu.org; Mon, 13 Feb 2017 11:55:53 -0500 Received: from [195.159.176.226] (port=35571 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cdJuo-000563-29 for emacs-orgmode@gnu.org; Mon, 13 Feb 2017 11:55:50 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cdJuU-00008i-M6 for emacs-orgmode@gnu.org; Mon, 13 Feb 2017 17:55:30 +0100 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" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Nicolas Goaziou writes: > Hello, > > Rasmus writes: > >> IOW the problems are all fairly easy to deal with once we've added :style >> and :class support to more places in ox-html. > > Great. Would you, or anyone else, be interested in working on this? Here's a quick attempt. Do you want me to push it? Rasmus -- Bang bang --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ox-html-plain-list-supports-arbitrary-attributes.patch >From 0760016f2b100f4050e16f5682eca305178f3494 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Mon, 13 Feb 2017 17:52:38 +0100 Subject: [PATCH] ox-html: plain list supports arbitrary attributes * lisp/ox-html.el (org-html-plain-list-type): New defconst. (org-html-begin-plain-list): (org-html-plain-list): (org-html-end-plain-list): Use new defconst and support attributes. --- lisp/ox-html.el | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index ef8c9b546..1f3def999 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -449,6 +449,10 @@ You can use `org-html-head' and `org-html-head-extra' to add to this style. If you don't want to include this default style, customize `org-html-head-include-default-style'.") +(defconst org-html-plain-list-type + '(ordered "ol" unordered "ul" descriptive "dl") + "Plist of Org and html list types.") + ;;; User Configuration Variables @@ -3138,34 +3142,35 @@ the plist used as a communication channel." ;;;; Plain List -;; FIXME Maybe arg1 is not needed because
  • already sets -;; the correct value for the item counter -(defun org-html-begin-plain-list (type &optional arg1) +(defun org-html-begin-plain-list (type &optional attributes) "Insert the beginning of the HTML list depending on TYPE. When ARG1 is a string, use it as the start parameter for ordered lists." - (pcase type - (`ordered - (format "
      " - (if arg1 (format " start=\"%d\"" arg1) ""))) - (`unordered "
        ") - (`descriptive "
        "))) + (let* ((html-type (plist-get org-html-plain-list-type type)) + (html-class (format "org-%s" html-type))) + (format "<%s %s>" + html-type + (org-html--make-attribute-string + (plist-put attributes :class + (org-trim + (mapconcat 'identity + (list html-class (plist-get attributes :class)) + " "))))))) (defun org-html-end-plain-list (type) "Insert the end of the HTML list depending on TYPE." - (pcase type - (`ordered "
    ") - (`unordered "") - (`descriptive ""))) + (format "" (plist-get org-html-plain-list-type type))) (defun org-html-plain-list (plain-list contents _info) "Transcode a PLAIN-LIST element from Org to HTML. CONTENTS is the contents of the list. INFO is a plist holding contextual information." - (let ((type (org-element-property :type plain-list))) + (let* ((type (org-element-property :type plain-list)) + (attributes (org-export-read-attribute :attr_html plain-list))) (format "%s\n%s%s" - (org-html-begin-plain-list type) - contents (org-html-end-plain-list type)))) + (org-html-begin-plain-list type attributes) + contents + (org-html-end-plain-list type)))) ;;;; Plain Text -- 2.11.1 --=-=-=--