emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Scott Randby <srandby@gmail.com>
To: Xebar Saram <zeltakc@gmail.com>, org mode <emacs-orgmode@gnu.org>
Subject: Re: Complex conversion of text to org table
Date: Sun, 12 Mar 2017 12:46:22 -0400	[thread overview]
Message-ID: <8f1563ce-dba6-9e9a-eae6-e96022eb78d2@gmail.com> (raw)
In-Reply-To: <CAOQHXPoHNxmxBW4i8KXiBspbwN2MGOySsTNM-rLmh3Pcx+csnw@mail.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

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

  reply	other threads:[~2017-03-12 16:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f1563ce-dba6-9e9a-eae6-e96022eb78d2@gmail.com \
    --to=srandby@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=zeltakc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).