From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [RFC] Rewrite radio tables
Date: Sun, 24 Aug 2014 22:18:03 +0200 [thread overview]
Message-ID: <87fvglhcas.fsf@gmail.com> (raw)
In-Reply-To: 8761hh6662.fsf@nicolasgoaziou.fr
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
Hello,
> The following patch implements radio tables and `orgtbl-to-...'
> functions using Org export engine. The implementation is probably not
> totally backward compatible, though.
funny, I just wrote `org-dp-create-table' (in
https://github.com/tj64/org-dp) a few hours ago, obviously it is not
competing with this rather complex framework of Org table creation, but
it does its job and might be useful for anybody just looking for a
simple way to create a table programmatically.
Usage is:
#+BEGIN_SRC emacs-lisp :results raw
(org-dp-create-table
(list
'("col1" "col2" "col3")
'hline
'("a" "b" "c")
'(1 2 3)
'hline
'(x y z)))
#+END_SRC
#+results:
| col1 | col2 | col3 |
|------+------+------|
| a | b | c |
| 1 | 2 | 3 |
|------+------+------|
| x | y | z |
implementation is:
#+BEGIN_SRC emacs-lisp
(defun org-dp-create-table (row-lst)
"Create table of type 'org'.
ROW-LST is an alist of lists with elements that are contents of a
single row's table cells, e.g.
(list
(list \"col1\" \"col2\" \"col3\")
'hline
(list 1 2 3)
(list 'x 'y 'z))
for a table with 3 columns and 4 rows, including one horizontal
line."
;; table
(org-dp-create
'table
(mapconcat
(lambda (--row-cells)
(if (eq --row-cells 'hline)
;; rule rows
(org-dp-create 'table-row nil nil nil :type 'rule)
;; standard rows
(org-dp-create 'table-row
(mapconcat
(lambda (--cell-cont)
;; cells
(org-dp-create 'table-cell
(format "%s" --cell-cont)))
--row-cells "")
nil nil :type 'standard)))
row-lst "")
nil nil :type 'org))
#+END_SRC
--
cheers,
Thorsten
next prev parent reply other threads:[~2014-08-24 20:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-24 19:25 [RFC] Rewrite radio tables Nicolas Goaziou
2014-08-24 20:18 ` Thorsten Jolitz [this message]
2014-08-24 20:51 ` Thorsten Jolitz
2014-08-25 16:08 ` Nick Dokos
2014-08-25 16:11 ` Nick Dokos
2014-08-25 19:20 ` Nicolas Goaziou
2014-09-13 13:23 ` Nicolas Goaziou
2014-08-27 14:50 ` AW
2014-08-27 23:33 ` Nicolas Goaziou
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=87fvglhcas.fsf@gmail.com \
--to=tjolitz@gmail.com \
--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).