emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Yasushi SHOJI <yashi@atmark-techno.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: New Exporter: plain list depth
Date: Mon, 22 Apr 2013 00:10:25 +0200	[thread overview]
Message-ID: <87haizmt66.fsf@gmail.com> (raw)
In-Reply-To: <87d2tnwphd.wl@dns1.atmark-techno.com> (Yasushi SHOJI's message of "Mon, 22 Apr 2013 06:19:58 +0900")

Hello,

Yasushi SHOJI <yashi@atmark-techno.com> 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

  reply	other threads:[~2013-04-21 22:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21 21:19 Yasushi SHOJI
2013-04-21 22:10 ` Nicolas Goaziou [this message]
2013-04-23 12:25   ` Yasushi SHOJI

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=87haizmt66.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yashi@atmark-techno.com \
    --subject='Re: New Exporter: plain list depth' \
    /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

Code repositories for project(s) associated with this 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).