From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: New Exporter: plain list depth Date: Mon, 22 Apr 2013 00:10:25 +0200 Message-ID: <87haizmt66.fsf@gmail.com> References: <87d2tnwphd.wl@dns1.atmark-techno.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UU2Ss-0003TT-5q for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 18:10:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UU2Sq-0006qe-L1 for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 18:10:30 -0400 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:55990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UU2Sq-0006qS-EI for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 18:10:28 -0400 Received: by mail-wi0-f174.google.com with SMTP id m6so3356260wiv.1 for ; Sun, 21 Apr 2013 15:10:27 -0700 (PDT) In-Reply-To: <87d2tnwphd.wl@dns1.atmark-techno.com> (Yasushi SHOJI's message of "Mon, 22 Apr 2013 06:19:58 +0900") 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: Yasushi SHOJI Cc: emacs-orgmode@gnu.org Hello, Yasushi SHOJI writes: > What is the best way to know the depth of list entries when I writing > an exporter back-end? > > let's say I have: > > #+BEGIN_SRC org > * headline 1 > - list 1 > - list 2 > - list 2.1 > #+END_SRC > > I'd like to convert it to: > > #+BEGIN_EXAMPLE > * headline 1 > - list 1 > - list 2 > -- list 2.1 > #+END_EXAMPLE > > > To generate "--" at the list 2.1, I'd like to find out the list 2.1 is > at depth 2, so that I can use (make-string 2 ?-) for my bullet. Something like the following should work, assuming ITEM is the item element you have to transcode: #+begin_src emacs-lisp (let ((parent item) (depth 0)) (while (and (setq parent (org-export-get-parent parent)) (case (org-element-type parent) (item t) (plain-list (incf depth))))) depth) #+end_src > Does org-list-to-generic work in this situation? As a good rule of thumb, it's best to rely on tools provided in ox.el. Regards, -- Nicolas Goaziou