From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: Complex conversion of text to org table Date: Sun, 12 Mar 2017 17:35:49 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c115ad26a1a6a054a8a59c1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cn5XE-0002VR-3g for emacs-orgmode@gnu.org; Sun, 12 Mar 2017 11:35:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cn5XC-0006TG-Ui for emacs-orgmode@gnu.org; Sun, 12 Mar 2017 11:35:52 -0400 Received: from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]:33920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cn5XC-0006Sm-Mv for emacs-orgmode@gnu.org; Sun, 12 Mar 2017 11:35:50 -0400 Received: by mail-pf0-x234.google.com with SMTP id v190so59788241pfb.1 for ; Sun, 12 Mar 2017 08:35:50 -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: Vicente Vera Cc: org mode --94eb2c115ad26a1a6a054a8a59c1 Content-Type: text/plain; charset=UTF-8 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 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 : > >> 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 >> > > --94eb2c115ad26a1a6a054a8a59c1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thx Vicente!
=C2=A0
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 <vicente= mvp@gmail.com> wrote:
Hello. In = this case Org splits into columns everytime it sees a space, so "bakin= g soda" ends up in two columns. A brute force solution: replace the sp= aces 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-str= ing to replace '_' with ' '.

2017-03-12 15:14 GMT+00:00 Xebar Saram &= lt;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 but= ter, melted
cooking spray

if i mark this as a region and issue `= org-table-create-or-convert-from-region` this is the result

| =C2=A0 =C2=A0 3/4 | cup =C2=A0 =C2=A0 =C2=A0 =C2=A0 | milk = =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=A0 =C2=A0 =C2=A0 =C2=A0 |
| =C2=A0 =C2=A0 =C2=A0 2 | tablesp= oons | white =C2=A0 =C2=A0 =C2=A0 | vinegar | (%or | better | yet | lemon |= juice%) |
| =C2=A0 =C2=A0 =C2=A0 1 | cup =C2=A0 =C2=A0 =C2=A0 = =C2=A0 | all-purpose | flour =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 2 | tablespoons | white =C2=A0 = =C2=A0 =C2=A0 | sugar =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 1 | teaspoon =C2=A0 =C2=A0| baking =C2= =A0 =C2=A0 =C2=A0| powder =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 1/2 | teaspoon =C2=A0 =C2=A0| baking =C2=A0= =C2=A0 =C2=A0| soda =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 1/2 | teaspoon =C2=A0 =C2=A0| salt =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=A0 = =C2=A0 =C2=A0 =C2=A0 |
| =C2=A0 =C2=A0 =C2=A0 1 | egg =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=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 2 | tablespoons | butter, =C2=A0 =C2=A0 | melted = =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 |
| cooking | = spray =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=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 = |


as you can see it got the a= mount (1/2) and the unit (cup) right yet the actual ingredients is cut into= several columns

i dont really know how to deal with t= his. is there a more intelligent way of auto directing the conversion to sp= lit it the correct way?

if not any suggestions on = how to convert it in a better way? perhaps a command to quick delete the se= parator (|) across all the column?

thx alot in advance

Z


--94eb2c115ad26a1a6a054a8a59c1--