emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] tables, comment in one line, export to html


From: Michael Brand
Subject: Re: [O] tables, comment in one line, export to html
Date: Tue, 26 Apr 2016 18:25:34 +0200

Hi Uwe

On Tue, Apr 19, 2016 at 1:08 PM, Uwe Brauer <address@hidden> wrote:

> I would like to have a table entry in which the last colum contains
> comments which I don't want to export to html.
>
> Like this
>
> | Joe Smith      |  7 | 25 |  5 |    |  37 |       | #+begin_comment from 
> group B B #+end_comment |
>
> But this does not work. So how can I achieve it?

I have the same need now and just hacked something simple together to
export

    | / | /  |    | <r> |
    |   | 1n | 2y |  3y |

    | / | <r> | /  |    |
    |   |  1y | 2n | 3y |

    | /  | <r> | /  |
    | 1y |  2y | 3n |

    | / | /  | /  | <r> | /  | /  | /  |
    |   | 1n | 2n |  3y | 4n | 5n | 6n |

    | / | <r> | <l> | <r> | <l> | <r> | <l> |
    | / |   / | /   |   / |     |   / | /   |
    |   |  1n | 2n  |  3n | 4y  |  5n | 6n  |

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

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

as e. g. ASCII to

    :  2y  3y
    :
    :  1y  3y
    :
    :  1y  2y
    :
    :  3y
    :
    :  4y
    :
    :  4y
    :
    :   /  /    /
    :  1y  2y  3y  4y  5y  6y

with

    (add-hook 'org-export-before-processing-hook
              'f-ox-filter-table-column-del)
    (defun f-ox-filter-table-column-del (back-end)
      "Delete the 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 or rearrange column order in
    some other way. Make sure \"/\" is in $1 again after that."
      (while (re-search-forward
              "^[ \t]*| +/ +|\\(.*?|\\)?? +\\(/\\) +|" nil t)
        (goto-char (match-beginning 2))
        (org-table-delete-column)
        (beginning-of-line)))

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]