emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Complex conversion of text to org table
@ 2017-03-12 15:14 Xebar Saram
  2017-03-12 15:26 ` Vicente Vera
  2017-03-12 16:51 ` Thierry Banel
  0 siblings, 2 replies; 8+ messages in thread
From: Xebar Saram @ 2017-03-12 15:14 UTC (permalink / raw)
  To: org mode

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

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Complex conversion of text to org table
  2017-03-12 15:14 Complex conversion of text to org table Xebar Saram
@ 2017-03-12 15:26 ` Vicente Vera
  2017-03-12 15:35   ` Xebar Saram
  2017-03-12 16:51 ` Thierry Banel
  1 sibling, 1 reply; 8+ messages in thread
From: Vicente Vera @ 2017-03-12 15:26 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

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

Hello. In this case Org splits into columns everytime it sees a space, so
"baking soda" ends up in two columns. A brute force solution: replace the
spaces between words that shouldn't be put into separated columns with an
underscore:

1_cup all-purpose_flour

Convert it to an Org table and then do a quick M-x replace-string to
replace '_' with ' '.

2017-03-12 15:14 GMT+00:00 Xebar Saram <zeltakc@gmail.com>:

> 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
>

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Complex conversion of text to org table
  2017-03-12 15:26 ` Vicente Vera
@ 2017-03-12 15:35   ` Xebar Saram
  2017-03-12 16:46     ` Scott Randby
  2017-03-12 16:52     ` Scott Randby
  0 siblings, 2 replies; 8+ messages in thread
From: Xebar Saram @ 2017-03-12 15:35 UTC (permalink / raw)
  To: Vicente Vera; +Cc: org mode

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

Thx Vicente!

Thats a decent idea. can this be all wrapped in a function (i have zero
coding skills :)) ? i have hundreds of these tables to convert :)

best!

Z

On Sun, Mar 12, 2017 at 5:26 PM, Vicente Vera <vicentemvp@gmail.com> wrote:

> Hello. In this case Org splits into columns everytime it sees a space, so
> "baking soda" ends up in two columns. A brute force solution: replace the
> spaces between words that shouldn't be put into separated columns with an
> underscore:
>
> 1_cup all-purpose_flour
>
> Convert it to an Org table and then do a quick M-x replace-string to
> replace '_' with ' '.
>
> 2017-03-12 15:14 GMT+00:00 Xebar Saram <zeltakc@gmail.com>:
>
>> 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
>>
>
>

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Complex conversion of text to org table
  2017-03-12 15:35   ` Xebar Saram
@ 2017-03-12 16:46     ` Scott Randby
  2017-03-12 16:52     ` Scott Randby
  1 sibling, 0 replies; 8+ messages in thread
From: Scott Randby @ 2017-03-12 16:46 UTC (permalink / raw)
  To: Xebar Saram, org mode

On 03/12/2017 11:35 AM, Xebar Saram wrote:
> Thx Vicente!
>  
> Thats a decent idea. can this be all wrapped in a function (i have zero
> coding skills :)) ? i have hundreds of these tables to convert :)
> 
> best!
> 
> Z

You can try using commas to separate items.

List with commas inserted:

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

(Notice that I eliminated the comma in "butter, melted")

Resulting table:

| 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     |

Scott Randby

> 
> On Sun, Mar 12, 2017 at 5:26 PM, Vicente Vera <vicentemvp@gmail.com
> <mailto:vicentemvp@gmail.com>> wrote:
> 
>     Hello. In this case Org splits into columns everytime it sees a
>     space, so "baking soda" ends up in two columns. A brute force
>     solution: replace the spaces between words that shouldn't be put
>     into separated columns with an underscore:
> 
>     1_cup all-purpose_flour
> 
>     Convert it to an Org table and then do a quick M-x replace-string to
>     replace '_' with ' '.
> 
>     2017-03-12 15:14 GMT+00:00 Xebar Saram <zeltakc@gmail.com
>     <mailto:zeltakc@gmail.com>>:
> 
>         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
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Complex conversion of text to org table
  2017-03-12 15:14 Complex conversion of text to org table Xebar Saram
  2017-03-12 15:26 ` Vicente Vera
@ 2017-03-12 16:51 ` Thierry Banel
  1 sibling, 0 replies; 8+ messages in thread
From: Thierry Banel @ 2017-03-12 16:51 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Complex conversion of text to org table
  2017-03-12 15:35   ` Xebar Saram
  2017-03-12 16:46     ` Scott Randby
@ 2017-03-12 16:52     ` Scott Randby
  2017-03-14  0:56       ` Vicente Vera
  1 sibling, 1 reply; 8+ messages in thread
From: Scott Randby @ 2017-03-12 16:52 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

On 03/12/2017 11:35 AM, Xebar Saram wrote:
> Thx Vicente!
>  
> Thats a decent idea. can this be all wrapped in a function (i have zero
> coding skills :)) ? i have hundreds of these tables to convert :)
> 
> best!
> 
> Z

OR

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

| 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     |

Scott

> 
> On Sun, Mar 12, 2017 at 5:26 PM, Vicente Vera <vicentemvp@gmail.com
> <mailto:vicentemvp@gmail.com>> wrote:
> 
>     Hello. In this case Org splits into columns everytime it sees a
>     space, so "baking soda" ends up in two columns. A brute force
>     solution: replace the spaces between words that shouldn't be put
>     into separated columns with an underscore:
> 
>     1_cup all-purpose_flour
> 
>     Convert it to an Org table and then do a quick M-x replace-string to
>     replace '_' with ' '.
> 
>     2017-03-12 15:14 GMT+00:00 Xebar Saram <zeltakc@gmail.com
>     <mailto:zeltakc@gmail.com>>:
> 
>         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
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Complex conversion of text to org table
  2017-03-12 16:52     ` Scott Randby
@ 2017-03-14  0:56       ` Vicente Vera
  2017-03-14 13:18         ` John Kitchin
  0 siblings, 1 reply; 8+ messages in thread
From: Vicente Vera @ 2017-03-14  0:56 UTC (permalink / raw)
  To: Scott Randby; +Cc: Xebar Saram, org mode

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

OK that's a nice trick. Very useful for CSV files. Thanks!

2017-03-12 16:52 GMT+00:00 Scott Randby <srandby@gmail.com>:

> On 03/12/2017 11:35 AM, Xebar Saram wrote:
> > Thx Vicente!
> >
> > Thats a decent idea. can this be all wrapped in a function (i have zero
> > coding skills :)) ? i have hundreds of these tables to convert :)
> >
> > best!
> >
> > Z
>
> OR
>
> 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
>
> | 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     |
>
> Scott
>
> >
> > On Sun, Mar 12, 2017 at 5:26 PM, Vicente Vera <vicentemvp@gmail.com
> > <mailto:vicentemvp@gmail.com>> wrote:
> >
> >     Hello. In this case Org splits into columns everytime it sees a
> >     space, so "baking soda" ends up in two columns. A brute force
> >     solution: replace the spaces between words that shouldn't be put
> >     into separated columns with an underscore:
> >
> >     1_cup all-purpose_flour
> >
> >     Convert it to an Org table and then do a quick M-x replace-string to
> >     replace '_' with ' '.
> >
> >     2017-03-12 15:14 GMT+00:00 Xebar Saram <zeltakc@gmail.com
> >     <mailto:zeltakc@gmail.com>>:
> >
> >         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
> >
> >
> >
>
>

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Complex conversion of text to org table
  2017-03-14  0:56       ` Vicente Vera
@ 2017-03-14 13:18         ` John Kitchin
  0 siblings, 0 replies; 8+ messages in thread
From: John Kitchin @ 2017-03-14 13:18 UTC (permalink / raw)
  To: Vicente Vera; +Cc: Xebar Saram, Scott Randby, org mode

See my solution here:
http://emacs.stackexchange.com/questions/31417/function-to-paste-text-as-a-orgmode-table/31425#31425

Vicente Vera writes:

> OK that's a nice trick. Very useful for CSV files. Thanks!
>
> 2017-03-12 16:52 GMT+00:00 Scott Randby <srandby@gmail.com>:
>
>> On 03/12/2017 11:35 AM, Xebar Saram wrote:
>> > Thx Vicente!
>> >
>> > Thats a decent idea. can this be all wrapped in a function (i have zero
>> > coding skills :)) ? i have hundreds of these tables to convert :)
>> >
>> > best!
>> >
>> > Z
>>
>> OR
>>
>> 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
>>
>> | 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     |
>>
>> Scott
>>
>> >
>> > On Sun, Mar 12, 2017 at 5:26 PM, Vicente Vera <vicentemvp@gmail.com
>> > <mailto:vicentemvp@gmail.com>> wrote:
>> >
>> >     Hello. In this case Org splits into columns everytime it sees a
>> >     space, so "baking soda" ends up in two columns. A brute force
>> >     solution: replace the spaces between words that shouldn't be put
>> >     into separated columns with an underscore:
>> >
>> >     1_cup all-purpose_flour
>> >
>> >     Convert it to an Org table and then do a quick M-x replace-string to
>> >     replace '_' with ' '.
>> >
>> >     2017-03-12 15:14 GMT+00:00 Xebar Saram <zeltakc@gmail.com
>> >     <mailto:zeltakc@gmail.com>>:
>> >
>> >         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
>> >
>> >
>> >
>>
>>


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-03-14 13:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-12 15:14 Complex conversion of text to org table Xebar Saram
2017-03-12 15:26 ` Vicente Vera
2017-03-12 15:35   ` Xebar Saram
2017-03-12 16:46     ` Scott Randby
2017-03-12 16:52     ` Scott Randby
2017-03-14  0:56       ` Vicente Vera
2017-03-14 13:18         ` John Kitchin
2017-03-12 16:51 ` Thierry Banel

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).