emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to get header in second table generated by src block
@ 2012-03-10  7:00 Vladimir Lomov
  2012-03-10 16:58 ` Marc-Oliver Ihm
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Lomov @ 2012-03-10  7:00 UTC (permalink / raw)
  To: emacs-orgmode

--------------------------- 8< ---------------------------
#+TITLE: One code two tables

Hello, I'm adopting my workflow to org, and now I want to understand what I do wrong in following.

Suppose I have two tables with headers and three columns. In export to html I want to get two tables
with first and third columns only. The first table is
#+name: raw-to-table
#+begin_src emacs-lisp :var table=raw :exports results
  (mapcar
   (lambda (row)
     (if (equal row 'hline) ;; <- special handling for 'hline
         row
       (list (concat "~" (nth 0 row) "~") (nth 2 row))))
   table)
#+end_src

The second table is
#+call: raw-to-table[:exports results](table=raw2)

In my environment the second table doesn't have headers. Why? What I do wrong?

* COMMENT The tables data
#+tblname: raw
| Key  | Code  | Description |
|------+-------+-------------|
| KEY1 | CODE1 | DESCR1      |
| KEY2 | CODE2 | DESCR2      |
| KEY3 | CODE3 | DESCR3      |

Second table, key, code and description differ.

#+tblname: raw2
| Key    | Code    | Description |
|--------+---------+-------------|
| KEY_A1 | CODE_A1 | DESCR_A1    |
| KEY_A2 | CODE_A2 | DESCR_A2    |
| KEY_A3 | CODE_A3 | DESCR_A3    |


P.S. This is not mine code I borrowed it from Eric Schulte. Thanks Eric for the code!

P.S.S. The ~:exports results~ in ~#+call~ is taken from previous version
of code when I tried src block with ~:exports none~ (at first I wanted
to separate code and where to insert table).
--------------------------- 8< ---------------------------

-- 
It has been said that man is a rational animal.  All my life I have
been searching for evidence which could support this.
		-- Bertrand Russell

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to get header in second table generated by src block
  2012-03-10  7:00 How to get header in second table generated by src block Vladimir Lomov
@ 2012-03-10 16:58 ` Marc-Oliver Ihm
  2012-03-11  2:11   ` Vladimir Lomov
  0 siblings, 1 reply; 3+ messages in thread
From: Marc-Oliver Ihm @ 2012-03-10 16:58 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

if you add ":colnames yes", like this:

#+call: raw-to-table[:exports results](table=raw2) :colnames yes

you get the headers, that you expect.

regards, Marc

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to get header in second table generated by src block
  2012-03-10 16:58 ` Marc-Oliver Ihm
@ 2012-03-11  2:11   ` Vladimir Lomov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Lomov @ 2012-03-11  2:11 UTC (permalink / raw)
  To: emacs-orgmode

Hello,
** Marc-Oliver Ihm [2012-03-10 17:58:52 +0100]:

> Hi,

> if you add ":colnames yes", like this:

> #+call: raw-to-table[:exports results](table=raw2) :colnames yes

> you get the headers, that you expect.
Aha, I thought I should put ~:colnames~ inside ~[]~

> regards, Marc
Thanks Marc.

---
WBR, Vladimir Lomov

-- 
"...and the fully armed nuclear warheads, are, of course, merely a
courtesy detail."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-11  2:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-10  7:00 How to get header in second table generated by src block Vladimir Lomov
2012-03-10 16:58 ` Marc-Oliver Ihm
2012-03-11  2:11   ` Vladimir Lomov

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).