emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Michael Brand <michael.ch.brand@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: How to hide a table column from exporting
Date: Tue, 03 May 2016 16:57:20 +0000	[thread overview]
Message-ID: <CAFyQvY0HnV41D6cz+VFAbtB4ZgfxKddgDEVjmsxRMGnVj3xLOA@mail.gmail.com> (raw)
In-Reply-To: <CALn3zojN8fV6znwHLZQRdFA23dW0e5PZg86mV443bC=jYMREng@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2479 bytes --]

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


On Tue, Apr 26, 2016 at 12:29 PM Michael Brand <michael.ch.brand@gmail.com>
wrote:

> Hi Kaushal
>
> On Fri, Apr 22, 2016 at 8:40 PM, Kaushal Modi <kaushal.modi@gmail.com>
> wrote:
>
> > 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
>
> 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

[-- Attachment #2: Type: text/html, Size: 4302 bytes --]

  reply	other threads:[~2016-05-03 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 18:40 How to hide a table column from exporting Kaushal Modi
2016-04-26 16:29 ` Michael Brand
2016-05-03 16:57   ` Kaushal Modi [this message]
2018-05-07 20:45     ` Kaushal Modi
2018-05-11  4:27     ` stardiviner

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=CAFyQvY0HnV41D6cz+VFAbtB4ZgfxKddgDEVjmsxRMGnVj3xLOA@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=michael.ch.brand@gmail.com \
    /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).