[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Complex conversion of text to org table
From: |
Thierry Banel |
Subject: |
Re: [O] Complex conversion of text to org table |
Date: |
Sun, 12 Mar 2017 17:51:19 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
Use a regex replacement. Basically you replace the 1st space with a
vertical pipe:
M-x query-replace-regexp
^\([^ ]+\)
|\1|
answer yes repeatedly,
then type TAB to align the table.
Le 12/03/2017 16:14, Xebar Saram a écrit :
> Hi list
>
> so im trying to use orgmode to collect food recepies. i have one issue
> which is to convert text based ingridents list into org tables.
>
> for example take this list
>
> 3/4 cup milk
> 2 tablespoons white vinegar
> 1 cup all-purpose flour
> 2 tablespoons white sugar
> 1 teaspoon baking powder
> 1/2 teaspoon baking soda
> 1/2 teaspoon salt
> 1 egg
> 2 tablespoons butter, melted
> cooking spray
>
> if i mark this as a region and issue
> `org-table-create-or-convert-from-region` this is the result
>
> | 3/4 | cup | milk | | | |
> | | |
> | 2 | tablespoons | white | vinegar | (%or | better | yet
> | lemon | juice%) |
> | 1 | cup | all-purpose | flour | | |
> | | |
> | 2 | tablespoons | white | sugar | | |
> | | |
> | 1 | teaspoon | baking | powder | | |
> | | |
> | 1/2 | teaspoon | baking | soda | | |
> | | |
> | 1/2 | teaspoon | salt | | | |
> | | |
> | 1 | egg | | | | |
> | | |
> | 2 | tablespoons | butter, | melted | | |
> | | |
> | cooking | spray | | | | |
> | | |
>
>
> as you can see it got the amount (1/2) and the unit (cup) right yet
> the actual ingredients is cut into several columns
>
> i dont really know how to deal with this. is there a more intelligent
> way of auto directing the conversion to split it the correct way?
>
> if not any suggestions on how to convert it in a better way? perhaps a
> command to quick delete the separator (|) across all the column?
>
> thx alot in advance
>
> Z
Re: [O] Complex conversion of text to org table,
Thierry Banel <=