Discussion:
[O] How to hide a table column from exporting
Kaushal Modi
2016-04-22 18:40:53 UTC
Permalink
Hi,

I was trying to prevent an org table column from exporting to html. So I
started looking for a solution and found this:
http://stackoverflow.com/q/6641379/1219634

I have never used Radio Tables, and that too in org-mode itself (because it
looks like Radio Tables are designed to insert org-mode processed tables in
other major modes).

So I tried doing the below, and I cannot figure out how to insert the Radio
Table in that "Final Table" heading.

What I need to achieve:
- Not export the source table
- Generate the radio table at export time (even better if the radio table
updates each time I do C-u C-c C-c on the source table).

* Final Table
# BEGIN RECEIVE ORGTBL output-table
# END RECEIVE ORGTBL output-table

* Source Table
:noexport:
#+ORGTBL: SEND output-table orgtbl-to-html :skipcols (3)
|---+-----+------|
| 2 | 1/2 | junk |
| 4 | 1/4 | junk |
| 8 | 1/2 | junk |
|---+-----+------|

Org-mode version 8.3.4 (release_8.3.4-748-g7e320e @
/home/kmodi/usr_local/apps/6/emacs/emacs-25/share/emacs/site-lisp/org/)

Thanks.

Kaushal
--
--
Kaushal Modi
Michael Brand
2016-04-26 16:29:45 UTC
Permalink
Hi Kaushal
Post by Kaushal Modi
I was trying to prevent an org table column from exporting to html. So I
http://stackoverflow.com/q/6641379/1219634
Please see my answer for one solution in the thread "tables, comment
in one line, export to html" that started on 2016-04-19, e. g. at
http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683

Michael
Kaushal Modi
2016-05-03 16:57:20 UTC
Permalink
Thanks Michael!

That solution works great! I followed the discussion that followed in that
thread and have adopted the following solution in my config for now.

# http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683

| / | <#> | | <r> |
| | 1n | 2y | 3y |
# Exports to ASCII as
# 2y 3y

| / | <r> | <#> | |
| | 1y | 2n | 3y |
# Exports to ASCII as
# 1y 3y

| / | <r> | <#> |
| 1y | 2y | 3n |
# Exports to ASCII as
# 1y 2y

| / | <#> | <#> | <r> | <#> | <#> | <#> |
| | 1n | 2n | 3y | 4n | 5n | 6n |
# Exports to ASCII as
# 3y

| / | <r> | <l> | <r> | <l> | <r> | <l> |
| / | <#> | <#> | <#> | | <#> | <#> |
| | 1n | 2n | 3n | 4y | 5n | 6n |
# Exports to ASCII as
# 4y

# Same result with a less useful notation:
| / | <r> | <l> | <r> | <l> | <r> | <l> |
| / | <#> | <#> | | | <#> | <#> |
| / | | <#> | <#> | | | |
| | 1n | 2n | 3n | 4y | 5n | 6n |
# Exports to ASCII as
# 4y

# Deletion must not get trapped with this:
| / | <r> | <l> | <r> | <l> | <r> | <l> |
| / | | | | | | |
| | <#> | <#> | <#> | | | |
| | 1y | 2y | 3y | 4y | 5y | 6y |
# Exports to ASCII as
# <#> <#> <#>
# 1y 2y 3y 4y 5y 6y


* COMMENT
#+BEGIN_SRC emacs-lisp
(defun mbrand/org-export-delete-commented-cols (back-end)
"Delete columns $2 to $> marked as `<#>' on a row with `/' in $1.
If you want a non-empty column $1 to be deleted make it $2 by
inserting an empty column before and adding `/' in $1."
(while (re-search-forward "^[ \t]*| +/ +|\\(.*|\\)? +\\(<#>\\) *|" nil t)
(goto-char (match-beginning 2))
(org-table-delete-column)
(beginning-of-line)))
(add-hook 'org-export-before-processing-hook
#'mbrand/org-export-delete-commented-cols)
;; (remove-hook 'org-export-before-processing-hook
#'mbrand/org-export-delete-commented-cols)
#+END_SRC
Post by Michael Brand
Hi Kaushal
Post by Kaushal Modi
I was trying to prevent an org table column from exporting to html. So I
http://stackoverflow.com/q/6641379/1219634
Please see my answer for one solution in the thread "tables, comment
in one line, export to html" that started on 2016-04-19, e. g. at
http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683
Michael
--
--
Kaushal Modi
stardiviner
2018-05-11 04:27:24 UTC
Permalink
Hi, Modi, I try to apply you config into Org Radio Tables.

Like this:

,----
| #+ BEGIN RECEIVE ORGTBL test-table-comment-column
| | a | b |
| | 1 | 2 |
| #+ END RECEIVE ORGTBL test-table-comment-column
|
| #+ORGTBL: SEND test-table-comment-column orgtbl-to-orgtbl :splice nil :skip 0
| | / | <#> | <c> |
| | | a | b |
| | | 1 | 2 |
`----

But as you can see, the commented column is not deleted at radio table receive location.

Can it be adapted to Org Radio Tables?
--
[ stardiviner ] don't need to convince with trends.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
Continue reading on narkive:
Loading...