From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: How to hide a table column from exporting Date: Tue, 03 May 2016 16:57:20 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113e53e63f5ead0531f3016a Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axde7-0001tX-9J for emacs-orgmode@gnu.org; Tue, 03 May 2016 12:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axddu-0001MS-Mh for emacs-orgmode@gnu.org; Tue, 03 May 2016 12:57:57 -0400 Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:34058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axddt-00018Y-DL for emacs-orgmode@gnu.org; Tue, 03 May 2016 12:57:50 -0400 Received: by mail-oi0-x22d.google.com with SMTP id k142so34011902oib.1 for ; Tue, 03 May 2016 09:57:35 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Michael Brand Cc: emacs-org list --001a113e53e63f5ead0531f3016a Content-Type: text/plain; charset=UTF-8 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 | / | <#> | | | | | 1n | 2y | 3y | # Exports to ASCII as # 2y 3y | / | | <#> | | | | 1y | 2n | 3y | # Exports to ASCII as # 1y 3y | / | | <#> | | 1y | 2y | 3n | # Exports to ASCII as # 1y 2y | / | <#> | <#> | | <#> | <#> | <#> | | | 1n | 2n | 3y | 4n | 5n | 6n | # Exports to ASCII as # 3y | / | | | | | | | | / | <#> | <#> | <#> | | <#> | <#> | | | 1n | 2n | 3n | 4y | 5n | 6n | # Exports to ASCII as # 4y # Same result with a less useful notation: | / | | | | | | | | / | <#> | <#> | | | <#> | <#> | | / | | <#> | <#> | | | | | | 1n | 2n | 3n | 4y | 5n | 6n | # Exports to ASCII as # 4y # Deletion must not get trapped with this: | / | | | | | | | | / | | | | | | | | | <#> | <#> | <#> | | | | | | 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 wrote: > Hi Kaushal > > On Fri, Apr 22, 2016 at 8:40 PM, Kaushal Modi > 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 --001a113e53e63f5ead0531f3016a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks Michael!

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


| / | <#> | =C2=A0 =C2=A0| <r> |
| =C2=A0 | 1n =C2=A0| 2y | =C2=A03y |
# Exports to ASCII as=
# 2y =C2=A03y

| / | <r> | <#&g= t; | =C2=A0 =C2=A0|
| =C2=A0 | =C2=A01y | 2n =C2=A0| 3y |
# Exports to ASCII as
# 1y =C2=A03y

|= / =C2=A0| <r> | <#> |
| 1y | =C2=A02y | 3n =C2=A0|
# Exports to ASCII as
# 1y =C2=A02y

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

| / | <r> | <l> | <r> | <l> | <= r> | <l> |
| / | <#> | <#> | <#> | =C2= =A0 =C2=A0 | <#> | <#> |
| =C2=A0 | =C2=A01n | 2n =C2= =A0| =C2=A03n | 4y =C2=A0| =C2=A05n | 6n =C2=A0|
# Exports to ASC= II as
# 4y

# Same result with a less use= ful notation:
| / | <r> | <l> | <r> | <l>= | <r> | <l> |
| / | <#> | <#> | =C2=A0 = =C2=A0 | =C2=A0 =C2=A0 | <#> | <#> |
| / | =C2=A0 =C2= =A0 | <#> | <#> | =C2=A0 =C2=A0 | =C2=A0 =C2=A0 | =C2=A0 =C2=A0= |
| =C2=A0 | =C2=A01n | 2n =C2=A0| =C2=A03n | 4y =C2=A0| =C2=A05= n | 6n =C2=A0|
# Exports to ASCII as
# 4y
# Deletion must not get trapped with this:
| / | <= r> | <l> | <r> | <l> | <r> | <l> |
| / | =C2=A0 =C2=A0 | =C2=A0 =C2=A0 | =C2=A0 =C2=A0 | =C2=A0 =C2=A0 | = =C2=A0 =C2=A0 | =C2=A0 =C2=A0 |
| =C2=A0 | <#> | <#> = | <#> | =C2=A0 =C2=A0 | =C2=A0 =C2=A0 | =C2=A0 =C2=A0 |
| = =C2=A0 | =C2=A01y | 2y =C2=A0| =C2=A03y | 4y =C2=A0| =C2=A05y | 6y =C2=A0|<= /div>
# Exports to ASCII as
# <#> =C2=A0<#> =C2= =A0<#>
# =C2=A01y =C2=A02y =C2=A0 =C2=A03y =C2=A04y =C2=A05= y =C2=A06y


* COMMENT
#+BE= GIN_SRC emacs-lisp
(defun mbrand/org-export-delete-commented-cols= (back-end)
=C2=A0 "Delete columns $2 to $> marked as `&l= t;#>' 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."
=C2=A0 (while (re-search-f= orward "^[ \t]*| +/ +|\\(.*|\\)? +\\(<#>\\) *|" nil t)
=C2=A0 =C2=A0 (goto-char (match-beginning 2))
=C2=A0 =C2=A0= (org-table-delete-column)
=C2=A0 =C2=A0 (beginning-of-line)))
(add-hook 'org-export-before-processing-hook #'mbrand/org-e= xport-delete-commented-cols)
;; (remove-hook 'org-export-befo= re-processing-hook #'mbrand/org-export-delete-commented-cols)
#+END_SRC


<= div dir=3D"ltr">On Tue, Apr 26, 2016 at 12:29 PM Michael Brand <michael.ch.brand@gmail.com> w= rote:
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=3D106683

Michael
--

--
Kaushal Modi

--001a113e53e63f5ead0531f3016a--