emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Feature request: lists with letters
Date: Mon, 13 Feb 2017 17:55:23 +0100	[thread overview]
Message-ID: <87vaseni84.fsf@gmx.us> (raw)
In-Reply-To: 87shnip5he.fsf@nicolasgoaziou.fr

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Rasmus <rasmus@gmx.us> 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-plain-list-supports-arbitrary-attributes.patch --]
[-- Type: text/x-diff, Size: 2892 bytes --]

From 0760016f2b100f4050e16f5682eca305178f3494 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
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.")
+
 \f
 ;;; User Configuration Variables
 
@@ -3138,34 +3142,35 @@ the plist used as a communication channel."
 
 ;;;; Plain List
 
-;; FIXME Maybe arg1 is not needed because <li value="20"> 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 "<ol class=\"org-ol\"%s>"
-	     (if arg1 (format " start=\"%d\"" arg1) "")))
-    (`unordered "<ul class=\"org-ul\">")
-    (`descriptive "<dl class=\"org-dl\">")))
+  (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 "</ol>")
-    (`unordered "</ul>")
-    (`descriptive "</dl>")))
+  (format "</%s>" (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


  reply	other threads:[~2017-02-13 16:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1622a63fda844eb1aa553fdcd19a5758@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-02-03 12:40 ` Feature request: lists with letters Eric S Fraga
2017-02-03 13:47   ` Titus von der Malsburg
2017-02-06 15:34     ` Rasmus
2017-02-06 19:59       ` Titus von der Malsburg
2017-02-09  9:29         ` Rasmus
2017-02-10 10:58           ` Titus von der Malsburg
2017-02-11  1:20             ` Nicolas Goaziou
2017-02-13 10:51               ` Rasmus
2017-02-13 13:47                 ` Nicolas Goaziou
2017-02-13 16:55                   ` Rasmus [this message]
2017-02-13 20:39                     ` Nicolas Goaziou
2017-02-14 11:25                       ` Rasmus
2017-02-14 12:57                         ` Nicolas Goaziou
     [not found]             ` <9385a1ca2a23417399fb441d6d85795d@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-02-11 12:39               ` Eric S Fraga
2017-02-03 11:37 Titus von der Malsburg
  -- strict thread matches above, loose matches on Subject: below --
2017-02-02 17:28 Titus von der Malsburg
2017-02-02 17:55 ` Nicolas Goaziou
2017-02-02 19:42   ` Titus von der Malsburg
2017-02-02 19:57     ` Nicolas Goaziou
2017-02-02 20:05       ` Titus von der Malsburg
2017-02-02 20:19         ` Nicolas Goaziou
2017-02-02 20:33           ` Eric Abrahamsen
2017-02-03  8:50       ` Rainer M Krug
2017-02-03 16:22         ` William Denton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vaseni84.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).