MealMaster export fails

Asked by Charlie Figura

I've been using Gourmet for a number of years and enjoy it, but recently got an android tablet and would like to be able to export my recipes to a recipe app there. The good news: Gourmet exports MealMaster format (MMF) and the Android app reads MMF.

The bad news: MMF imports fail UNLESS the 'categories' and 'yield' fields are set in Gourmet. If I edit the MMF file and include the headers for "Categories" and "Yield but leave the fields blank, the import works just fine.

I do not have access to other MMF capable software, and I understand that this might be a problem with the other app. Nevertheless - can anyone verify that this behaviour is consistent? Should Gourmet be writing out these fields and leaving them blank to be consistent with the MMF format?

Thank you -

-Charlie

Question information

Language:
English Edit question
Status:
Answered
For:
Gourmet Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Stephen Haffly (stephenh-n) said :
#1

Charlie,

Have you considered downloading and running MealMaster? You may download
it from http://episoft.home.comcast.net/~episoft/

The program is freeware. Donations are requested, but not required. The
page has instructions for running it in 64 bit Windows 7/8. I use DosBox
to run it in Linux, so that method does work.

The problem I have observed is that when I export a recipe in what is
supposed to be a MealMaster format, the resulting recipe will not import
correctly into MealMaster. For example, I exported this recipe and
immediately had to edit it to change the line endings from CR (which
Linux uses) to CR/LF (which DOS/Windows uses).

MMMMM----- Recipe via Meal-Master (tm)

    Title: Oaty Rhubarb Streusel Bars
Categories: American, Desserts
Cooktime: 55 minutes
Preparation Time: 25 minutes
     Link: http://www.bhg.com/recipe/bars/oaty-rhubarb-streusel-bars/

---------------------------------BARS---------------------------------
  1 1/2 c quick-cooking rolled oats
      1 c all-purpose flour
    3/4 c packed brown sugar
    3/4 c butter
    1/4 c granulated sugar
      2 tb all-purpose flour
    1/2 t ground ginger
      2 c fresh or frozen unsweetened sliced rhubarb
      1 tb finely chopped crystallized ginger (optional)

-----------------------------GINGER ICING-----------------------------
    3/4 c powdered sugar
    1/4 t ground ginger
      4 t apricot nectar, orange juice, or milk

   Bar instructions:

   Preheat oven to 350 degrees F. Line 8x8x2-inch baking pan with heavy
   foil extended beyond pan edges.

   In large bowl stir together oats, the 1 cup flour, and brown sugar.
   Cut in butter until mixture resembles coarse crumbs. Set aside 1 cup
   oats mixture. Press remaining on bottom of prepared pan. Bake 25
   minutes.

   Meanwhile, in medium bowl stir together granulated sugar, 2
   tablespoons flour, and ground ginger. Add rhubarb; toss to coat.
   Spread on hot crust. Sprinkle reserved oats mixture; press lightly.

   Bake 30 to 35 minutes, until top is golden and filling is bubbly. Cool
   on rack. Drizzle icing, sprinkle crystallized ginger. Lift from pan;
   cut into bars. Store, covered, in refrigerator up to 2 days.

   Ginger Icing instructions:

   In small bowl stir together powdered sugar, ginger, and 3 to 4
   teaspoons apricot nectar, orange juice, or milk.

   Rating: 5/5 stars

   Source: Better Homes and Gardens, May 2008

   Nutrition Facts

    (Oaty Rhubarb Streusel Bars) Per serving:

     221 kcal cal.,

     10 g fat

     (5 g sat. fat,

     24 mg chol.,

     70 mg sodium,

     32 g carb.,

     1 g fiber,

     2 g pro.

     Percent Daily Values are based on a 2,000 calorie diet

MMMMM

When I imported the file I had just exported from Gourmet, the
ingredients were blank. The yield was set to 55 minutes. The directions
began with

Preparation Time: 25 minutes
     Link: http://www.bhg.com/recipe/bars/oaty-rhubarb-streusel-bars/

The ingredients followed along with the directions, but all were in the
directions section.

Unfortunately, I have not been able to have any success in exporting
from Gourmet and importing the exported recipe into MealMaster as
Gourmet's MealMaster format is not compliant with the MealMaster
formatting requirements.

Still, if you are working from a Windows environment, your experience
may not parallel mine. I have not tried running Gourmet and MealMaster
in Windows.

Respectfully,

Stephen Haffly

On 08/17/2014 07:12 PM, charles.figura wrote:
> New question #253226 on Gourmet:
> https://answers.launchpad.net/gourmet/+question/253226
>
> I've been using Gourmet for a number of years and enjoy it, but recently got an android tablet and would like to be able to export my recipes to a recipe app there. The good news: Gourmet exports MealMaster format (MMF) and the Android app reads MMF.
>
> The bad news: MMF imports fail UNLESS the 'categories' and 'yield' fields are set in Gourmet. If I edit the MMF file and include the headers for "Categories" and "Yield but leave the fields blank, the import works just fine.
>
> I do not have access to other MMF capable software, and I understand that this might be a problem with the other app. Nevertheless - can anyone verify that this behaviour is consistent? Should Gourmet be writing out these fields and leaving them blank to be consistent with the MMF format?
>
> Thank you -
>
> -Charlie
>

Revision history for this message
Charlie Figura (cfigura) said :
#2

Stephen - Thanks for your reply. I'm running gourmet on linux.

I did some further testing, and found a definite bug in Gourmet. I reported before that if I included blank 'category' and 'yield' headers, the import was successful.

I have found two new pieces of information:
1) The import will ONLY work if the 'yield' header (blank or not) is included. Absence of the 'yield' heard will cause the import to fail.
2) Gourmet is NOT exporting the 'yield' field, even when it is specified with in the Gourmet database.

It's certainly possible that Paprika should not bork if there's a missing 'yield' header - HOWEVER, Gourmet should CERTAINLY be writing it out if it exists.

Revision history for this message
Bernhard Reiter (ockham-razor) said :
#3

Thanks for reporting this, Charlie. I've just fixed the missing Yield field export in the source code (fix is at https://github.com/thinkle/gourmet/commit/a5fdea840873415495b151de9913af97942b2935 and will be part of 0.17.5.)

As for export of blank fields, I can hardly find any information if the MealMaster format mandates Category and Yield fields be present even when empty. Could someone check if MealMaster itself accepts files without those fields and report here? I'm inclined to believe it does, in which case I'd consider it a bug in Paprika to require them and would kindly ask you to report that issue there.

Revision history for this message
Stephen Haffly (stephenh-n) said :
#4

Hello Bernhard,

This is the import format for MealMaster. If Gourmet is not exporting
with this format, then the file will not import into MealMaster, and is
therefore not MealMaster compatible. This is the problem I noted in the
recipe I posted in my previous comment.

Also, since I am running MealMaster in a DOSBox session in Linux, is
there any way to get Gourmet to export using a CR/LF line ending in mmf
and txt files instead of just the LF that Linux uses? Now, I have to
manually open the exported file and then resave after changing the LF to
CR/LF in the text editor.

 MEAL-MASTER IMPORT FILE SPECIFICATIONS

The Meal-Master import function is designed to import recipes that
were exported from the program. However, the export format is a
simple text file that can be created by most text editor programs.
Many people have found that recipes from other sources can be edited
to look like a MM export file, allowing them to be imported to MM with
little or no retyping. The format required is described below.

FIXED FORMAT (LINES 1 THROUGH 6)

   Line 1 The first line of a valid recipe is a "recipe header" line.
           This line must begin with at least 5 hyphens ('-----'), and
           must contain the words "Meal-Master" somewhere on the line.
           Any lines found prior to this "recipe header" line will be
           ignored by Meal-Master.

           (Note: If this line is missing, Meal-Master will attempt to
           locate the "Title: " line described below, and continue with
           the import process. However, it is recommended that header
           lines be used when possible)

   Line 2 The word "Title:" must begin the line in any position before
           column 7, and be followed by one blank space. The recipe
           title must start after the blank space, and may be a maximum
           of 60 characters in length.

   Line 3 The word "Categories:" must begin the line, in any position,
           and be followed by one blank space. A maximum of 5 category
           names may be entered, beginning after the blank space. A
           comma should immediately follow each category name except
           the last one; for example "Cakes, Desserts". Category names
           should start with a capital letter, with the remaining
           characters in lower case letters.

   Line 4 A numeric quantity between 1 and 9999 (number of servings)
           must appear somewhere on this line.

VARIABLE FORMAT - LINES 5 AND GREATER

   Beginning with line 5, Meal-Master will attempt to identify each
   line as being an ingredient line, direction line, or the "end of
   recipe" trailer line.

   If a line is found that starts with 5 hyphens, and contains no
   characters other than hyphens and spaces, the program considers this
   the "end of recipe" trailer line. It will store the current recipe
   and begin searching for another "recipe header" as described in
   "Line 1" above.

   If all the following are true, the line will be interpreted as an
   ingredient and loaded into Meal-Master:

      1) Positions 1-7 contain a valid numeric quantity, either
         expressed as a whole number, decimal fraction, or common
         fraction, or are blank.
      2) Positions 9-10 contain one of the valid Meal-Master unit of
         measure codes, including blanks. (see list in program).

      3) Positions 12-39 contain text for an ingredient name, or a "-"
         in position 12 and text in positions 13-39 (the latter is a
         "continuation" line for the previous ingredient name).

      NOTE: Beginning with v8.03, Meal-Master will attempt to align
            the quantity, unit, and name information prior to import.
            This means that ingredient lines do not have to follow the
            column alignment above, as Meal-Master will automatically
            align the quantity, unit, and name fields as long as they
            contain valid data.

   If all the following are true, the line will be interpreted as an
   ingredient heading line:

      1) Positions 1-5 contain hyphens ("-----").

      2) The line is at least 40 characters long.

      3) The center three characters of the line are not blank or
         hyphens.

      Note: The easiest way to format a line that will be accepted as a
         heading is to start with 5 hyphens, then the heading text,
         then some other special character (like "=" or "@") to at
         least position 40.

   If the line does not qualify as an ingredient line, heading line, or
   end of recipe line, as specified above, data in positions 3-77 (or
   1-75 if positions 1-2 are non-blank) will be imported as a direction
   line.

   Note: One of the most common errors in formatting a recipe for
   import is an ingredient line that has been improperly formatted.
   When this is encountered, the line is usually interpreted as a
   direction line by the program. To help guard against this, the
   program will display an error message if it finds a line that
   appears to be a direction line FOLLOWED by a valid ingredient line.

   Note: A less common error is starting a direction line in positions
   12 or 13. Such a line "looks" like an ingredient line with no
   quantity or unit of measure, so an error message is given if it is
   found in the Direction section. Make sure that direction lines
   start before column 12 or after column 13.

Files can contain multiple recipes, so long as each begins with a
"header line" and ends with a "trailer" line. Any text in the file
that is not between the header and trailer lines is ignored.

NOTE: THIS SPECIFICATION IS ONLY VALID FOR MEAL-MASTER VERSION 7.0
        AND HIGHER, AND WILL NOT WORK PROPERLY WITH EARLIER VERSIONS.
        PLEASE OBTAIN VERSION 7.0 OR GREATER FOR PROPER RESULTS!

Respectfully,

Stephen Haffly

On 08/18/2014 07:42 AM, Bernhard Reiter wrote:
> Question #253226 on Gourmet changed:
> https://answers.launchpad.net/gourmet/+question/253226
>
> Status: Open => Needs information
>
> Bernhard Reiter requested more information:
> Thanks for reporting this, Charlie. I've just fixed the missing Yield
> field export in the source code (fix is at
> https://github.com/thinkle/gourmet/commit/a5fdea840873415495b151de9913af97942b2935
> and will be part of 0.17.5.)
>
> As for export of blank fields, I can hardly find any information if the
> MealMaster format mandates Category and Yield fields be present even
> when empty. Could someone check if MealMaster itself accepts files
> without those fields and report here? I'm inclined to believe it does,
> in which case I'd consider it a bug in Paprika to require them and would
> kindly ask you to report that issue there.
>

Revision history for this message
Stephen Haffly (stephenh-n) said :
#5

More information

Two files attached. One is a recipe exported in what should be
MealMaster format (almgran.mmf). The second is a screenshot of
MealMaster when attempting to import the file (mmerror.png). This
illustrates, I believe, the CR/LF vs. LF problem as the exported file
just has LF for line endings.

The second set of files is after I changed the LF to CR/LF and ran the
import again. The file is renamed to almgran2.mmf and the file imported
into and then exported from MealMaster is transfer.txt.

When it imported into MealMaster, the Yield read the cooking time. The
ingredients section is blank and the directions begin with the
Preparation Time line. The exported transfer.txt file does not show this
as well as it appears to be correct. However, when I go to the revise
menu function in MealMaster, it is easily visible that the ingredients
are blank and everything is shoved down to the Directions section.

Respectfully,

Stephen Haffly

On 08/18/2014 07:42 AM, Bernhard Reiter wrote:
> Question #253226 on Gourmet changed:
> https://answers.launchpad.net/gourmet/+question/253226
>
> Status: Open => Needs information
>
> Bernhard Reiter requested more information:
> Thanks for reporting this, Charlie. I've just fixed the missing Yield
> field export in the source code (fix is at
> https://github.com/thinkle/gourmet/commit/a5fdea840873415495b151de9913af97942b2935
> and will be part of 0.17.5.)
>
> As for export of blank fields, I can hardly find any information if the
> MealMaster format mandates Category and Yield fields be present even
> when empty. Could someone check if MealMaster itself accepts files
> without those fields and report here? I'm inclined to believe it does,
> in which case I'd consider it a bug in Paprika to require them and would
> kindly ask you to report that issue there.
>

Revision history for this message
Bernhard Reiter (ockham-razor) said :
#6

Stephen,

thx for the MM import format specs. That's quite the read, but at first glance already, Category and servings (Yield) are mandatory, so I'll add them; I'll also see to fixing the newlines.

As for your other message, I'm afraid Launchpad strips off attachments, so would you mind sending them directly to me? ockham ät raz döt or döt at

Bernhard

Revision history for this message
Stephen Haffly (stephenh-n) said :
#7

Proposal:

After the header and a blank line, Title must be present and on the
first line, Categories must be present and on the second line, and Yield
must be present and on the third line.

Cooktime and Preparation time are not part of the MealMaster format and
interfere with compatibility.

Fix the export format to comply with MealMaster format requirements.
When exporting, change the location of Cooktime and Preparation time
from the current location. Placing them below the directions would be
suitable as they would then be like a note in Gourmet's format. Rating
and Source are already placed below the directions. The rating is
something that could easily be dropped as it is not nearly as useful as
the cooking and preparation times.

If the attachments on the previous note got to you and did not get
stripped off, they should illustrate the situation quite clearly.
Otherwise, the MealMaster import file specifications should also provide
the information needed to ensure Gourmet's format complies with
MealMaster import requirements.

Respectfully,

Stephen Haffly

On 08/18/2014 07:42 AM, Bernhard Reiter wrote:
> Question #253226 on Gourmet changed:
> https://answers.launchpad.net/gourmet/+question/253226
>
> Status: Open => Needs information
>
> Bernhard Reiter requested more information:
> Thanks for reporting this, Charlie. I've just fixed the missing Yield
> field export in the source code (fix is at
> https://github.com/thinkle/gourmet/commit/a5fdea840873415495b151de9913af97942b2935
> and will be part of 0.17.5.)
>
> As for export of blank fields, I can hardly find any information if the
> MealMaster format mandates Category and Yield fields be present even
> when empty. Could someone check if MealMaster itself accepts files
> without those fields and report here? I'm inclined to believe it does,
> in which case I'd consider it a bug in Paprika to require them and would
> kindly ask you to report that issue there.
>

Revision history for this message
Bernhard Reiter (ockham-razor) said :
#8
Revision history for this message
Stephen Haffly (stephenh-n) said :
#9

Thank you. I took the full version as listed on the "View" button, and
copied it to replace the mealmaster_exporter.py file in
/usr/lib/python2.7/site-packages/gourmet/plugins/import_export/mealmaster_plugin/
(after backing up the original version).

It mostly works now. There is still a couple of minor issues.

1. The full line length for import is 39 characters. Some of the
ingredients in Gourmet go beyond that. This throws things off so that
some ingredients still get interpreted as directions.
2. The padding in the exported file seems to be off by one character.
For example, positions 1-7 should be a quantity, 8 a space, 9 and 10
units of measure, 11 a space, and 12-39 ingredient or in a line
beginning in the 12th position with a hyphen, a continuation line of the
previous ingredient line.

What I saw when I tested:
123456789012345678921234567893123456789
MMMMM----- Recipe via Meal-Master (tm)

      Title: Oaty Rhubarb Streusel Bars
Categories: American, Desserts
      Yield: 16 servings

---------------------------------BARS---------------------------------
This header bar was recognized as were the ingredients above the numbers
below.
However, the numbers also illustrate that there is a minor padding
problem. The quantities are filling columns 1-6 instead of 1-7, which
then puts the units in columns 8 and 9 instead of 9 and 10. The
ingredients are beginning at position 11 instead of position 12.

I changed line 92 to reflect 7 instead of 6, making it read:
         self.amtlen=7

This seemed to fix it. Was this the correct place to do so?

123456789012345678921234567893123456789
  1 1/2 c quick-cooking rolled oats
      1 c all-purpose flour
    3/4 c packed brown sugar
    3/4 c butter
    1/4 c granulated sugar
      2 tb all-purpose flour
    1/2 t ground ginger
123456789012345678921234567893123456789
      2 c unsweetened sliced rhubarb, fresh or frozen
      1 tb finely chopped crystallized ginger (optional)
The extra characters after position 39 threw off MealMaster's import.
Unfortunately, it is hard to say where it should be wrapped. It would
look odd to split a word arbitrarily after the 39th character.
Truncating is also not a good option as the line may contain important
information.

-----------------------------GINGER ICING-----------------------------
    3/4 c powdered sugar
    1/4 t ground ginger
123456789012345678921234567893123456789
      4 t apricot nectar, orange juice, or milk

   Bar instructions:
   Preheat oven to 350 degrees F. Line 8x8x2-inch baking pan with heavy
   foil extended beyond pan edges.
   In large bowl stir together oats, the 1 cup flour, and brown sugar.
   Cut in butter until mixture resembles coarse crumbs. Set aside 1 cup
   oats mixture. Press remaining on bottom of prepared pan. Bake 25
   minutes.
   Meanwhile, in medium bowl stir together granulated sugar, 2
   tablespoons flour, and ground ginger. Add rhubarb; toss to coat.
   Spread on hot crust. Sprinkle reserved oats mixture; press lightly.
   Bake 30 to 35 minutes, until top is golden and filling is bubbly. Cool
   on rack. Drizzle icing, sprinkle crystallized ginger. Lift from pan;
   cut into bars. Store, covered, in refrigerator up to 2 days.
   Ginger Icing instructions:
   In small bowl stir together powdered sugar, ginger, and 3 to 4
   teaspoons apricot nectar, orange juice, or milk.

   Preparation Time: 25 minutes
   Cooking Time: 55 minutes
   Source: Better Homes and Gardens, May 2008
   Rating: 5/5 stars

This is excellent! Placing the Preparation and Cooking Time down here
along with the source and rating works well.

   Nutrition Facts
    (Oaty Rhubarb Streusel Bars) Per serving:
     221 kcal cal.,
     10 g fat
     (5 g sat. fat,
     24 mg chol.,
     70 mg sodium,
     32 g carb.,
     1 g fiber,
     2 g pro.
     Percent Daily Values are based on a 2,000 calorie diet

MMMMM

Respectfully,

Stephen Haffly

On 08/23/2014 04:37 PM, Bernhard Reiter wrote:
> Question #253226 on Gourmet changed:
> https://answers.launchpad.net/gourmet/+question/253226
>
> Bernhard Reiter posted a new comment:
> Okay, I've hopefully fixed this correctly now, see
> https://github.com/thinkle/gourmet/commit/704e40ebb6b0774cc9040d8c48523911ad65f194
>

Revision history for this message
Stephen Haffly (stephenh-n) said :
#10

Example after changing line padding:

MMMMM----- Recipe via Meal-Master (tm)

      Title: Kefir Biscuits
Categories: American, Breads
      Yield: 1 dozen
          1 2 3 4 5 6 7
1234567890123456789012345678901234567890123456789012345678901234567890
       2 c whole wheat flour (mix of bread and pastry)
       2 ts baking powder
     1/4 ts baking soda
       1 ts salt
     1/4 c shortening (non-hydrogenated)
     3/4 c Kefir (can substitute buttermilk)

   Sift dry ingredients into a mixing bowl. Measure shortening and cut
   into flour mixture with pastry blender or fork until finely blended
   (should resemble meal)
   Stir in almost all of the milk. If the dough does not seem pliable,
   add the rest. Use enough to make a soft, puffy dough, easy to roll
   out.
   Round up on a floured cloth covered board (cloth optional) and knead
   lightly (about six times). Roll out about 1/2" thick for thick
   biscuits or 1/4" thick for thin biscuits.
   Place on ungreased baking sheet. Bake until lightly browned (golden
   brown if using white flour).
   Serve hot with toppings of choice.

The ingredients are now in positions 1-7, units are now in positions
9-10, and ingredients begin at position 12. The wrap problem remains.
The first ingredient needs to be truncated or wrapped. If the part in
parenthesis were wrapped, that would fix that line. It would then appear as:

       2 c Whole wheat flour
            -(mix of bread and pastry)

That would then work. Wrapping the shortening line which is one
character too long or the Kefir line, which is 5 characters too long
could be done by wrapping the comment in the parenthesis again, which
would make them:

     1/4 c shortening
            -(non-hydrogenated)
     3/4 c Kefir
            -(can substitute buttermilk)

Both of these lines are now less than 40 characters. If a line had just
words with other punctuation, then wrapping before the word which would
exceed 39 characters would work. For example,

       4 t apricot nectar, orange juice, or milk
could read
       4 t apricot nectar,
            -orange juice, or milk (the comma after juice would be the
40th character and beginning a continuation line with a comma would not
look good.
or
       4 t apricot nectar, orange
            -juice, or milk

       2 c fresh or frozen unsweetened sliced rhubarb
could read
       2 c fresh or frozen unsweetened
            -sliced rhubarb
This ingredient would have been better written as rhubarb, unsweetened
sliced, fresh or frozen. It was a web page import, so without manually
editing it to put the ingredient first, a continuation line is awkward,
but still works.

Respectfully,

Stephen Haffly

On 08/23/2014 04:37 PM, Bernhard Reiter wrote:
> Question #253226 on Gourmet changed:
> https://answers.launchpad.net/gourmet/+question/253226
>
> Bernhard Reiter posted a new comment:
> Okay, I've hopefully fixed this correctly now, see
> https://github.com/thinkle/gourmet/commit/704e40ebb6b0774cc9040d8c48523911ad65f194
>

Revision history for this message
Bernhard Reiter (ockham-razor) said :
#11

Stephen,

thanks for your thorough analysis and assistance! I've just pushed another commit which hopefully fixes those remaining issues:
https://github.com/thinkle/gourmet/commit/73f8e1b0e97fc3bdbf01f2f8812a338db461c75d

I think you're right about setting self.amtlen to 7, even though the comments above that line seemed to suggest otherwise.

As for line-wrapping long ingredients, I'm afraid looking out for punctuation would be both rather complex and unreliable (e.g. for ingredients containing no commas, periods or parentheses at all), so I'm instead using Python's textwrap capabilities (which we're already using for line-wrapping recipe instructions and notes), and which should break lines "softly" at whitespace characters to ensure lines are shorter than 39 characters.

I'd be grateful if you could give this new version of the MM exporter another try as you did with the last iteration. While I've meanwhile also installed MM in a Dosbox on my Ubuntu, my test recipes are mostly German language and seem to feature units that MM doesn't understand easily (or maybe it's the diacritics).

(One thing I've noticed is that even though MM specs require ingredient lines end at column 39, I think that it sometimes does successfully import longer lines as ingredients, such as in the Almond Crunch Granola recipe file (almgran2.mmf) you sent me earlier, where " 1 2/3 c oat flakes and wheat flakes, mixed" is 45 characters wide. Am I mistaken here?)

Bernhard

Revision history for this message
Stephen Haffly (stephenh-n) said :
#12

Bernhard,

I'm glad to help. I will test the new commit shortly.

As for seeming to import correctly, you are right that it appears to do
so. Where it really shows up is when you then try to revise the recipe
in MealMaster. That is where you will see that the line length will have
an effect on import. If you just view the recipe, it does not show up
and the recipe appears to have imported correctly. When you revise the
recipe, you can see that the ingredient count is less than the number of
ingredients. Anything additional is then pushed down to the Directions
section.

I am attaching some files to illustrate this. test3.mmf is a recipe
exported from Gourmet. The mm_import#.png files illustrate this.

I agree that diacritics throw MealMaster's import off. It was designed
to run in a DOS environment. Whether the problem resides with MealMaster
or DOS is something I do not have the skill to determine..

I hope that my attempt to send the text in a fixed-width font was
successful. It helped to illustrate the problem which was not so easily
visible when trying to put it in a message with variable length fonts.
Using Python's textwrap is probably the best solution to the problem,
even though it may produce some less than ideal wrapping in some cases.

Respectfully,

Stephen Haffly

On 08/25/2014 12:26 PM, Bernhard Reiter wrote:
> Question #253226 on Gourmet changed:
> https://answers.launchpad.net/gourmet/+question/253226
>
> Bernhard Reiter requested more information:
> Stephen,
>
> thanks for your thorough analysis and assistance! I've just pushed another commit which hopefully fixes those remaining issues:
> https://github.com/thinkle/gourmet/commit/73f8e1b0e97fc3bdbf01f2f8812a338db461c75d
>
> I think you're right about setting self.amtlen to 7, even though the
> comments above that line seemed to suggest otherwise.
>
> As for line-wrapping long ingredients, I'm afraid looking out for
> punctuation would be both rather complex and unreliable (e.g. for
> ingredients containing no commas, periods or parentheses at all), so I'm
> instead using Python's textwrap capabilities (which we're already using
> for line-wrapping recipe instructions and notes), and which should break
> lines "softly" at whitespace characters to ensure lines are shorter than
> 39 characters.
>
> I'd be grateful if you could give this new version of the MM exporter
> another try as you did with the last iteration. While I've meanwhile
> also installed MM in a Dosbox on my Ubuntu, my test recipes are mostly
> German language and seem to feature units that MM doesn't understand
> easily (or maybe it's the diacritics).
>
> (One thing I've noticed is that even though MM specs require ingredient
> lines end at column 39, I think that it sometimes does successfully
> import longer lines as ingredients, such as in the Almond Crunch Granola
> recipe file (almgran2.mmf) you sent me earlier, where " 1 2/3 c oat
> flakes and wheat flakes, mixed" is 45 characters wide. Am I mistaken
> here?)
>
> Bernhard
>

Revision history for this message
Stephen Haffly (stephenh-n) said :
#13

Bernhard,

Wonderful! It is working much better. The ingredients are now all
recognized as ingredients with the proper continuation lines. Thank you
so much for fixing this.

There are a couple of minor things.

1. For accuracy, instead of an exported recipe reading, "Recipe via
Meal-Master (tm)," how about "Meal-Master (tm) export from Gourmet
Recipe Manager?" That would allow you to have the credit for Gourmet and
the file still imports correctly into Meal-Master. I tested this and can
verify that it works. The specification only says that "Meal-Master"
must appear somewhere on the header line after the 5 hyphens.

2. The second is something I am not sure anything can or even should be
done to fix it. The recipe exported from Gourmet with the instructions
showing sections as entered but when the recipe was imported into
Meal-Master, the formatting was lost. Example:

Bars:
Directions for bars . . .

becomes:

Bars: Directions for bars . . .

Ginger Icing instructions:
Directions for icing . . .

becomes

Ginger Icing instructions: Directions for icing . . .

Also, this is minor and not a big deal. I did find that if there is not
a blank line between the Bars instructions and the Ginger Icing
instructions, that the text would just be incorporated into one big
block and not separated as it should be. That part is easily fixed by
ensuring that there is a blank line in the Instructions in Gourmet. Then
the recipe exports with a blank line and the Meal-Master import keeps
the two separate. Since it is easily addressed in formatting recipe
instructions in Gourmet, this is something that could be looked at
later, if at all.

Respectfully,

Stephen Haffly

On 08/25/2014 12:26 PM, Bernhard Reiter wrote:
> Question #253226 on Gourmet changed:
> https://answers.launchpad.net/gourmet/+question/253226
>
> Bernhard Reiter requested more information:
> Stephen,
>
> thanks for your thorough analysis and assistance! I've just pushed another commit which hopefully fixes those remaining issues:
> https://github.com/thinkle/gourmet/commit/73f8e1b0e97fc3bdbf01f2f8812a338db461c75d
>
> I think you're right about setting self.amtlen to 7, even though the
> comments above that line seemed to suggest otherwise.
>
> As for line-wrapping long ingredients, I'm afraid looking out for
> punctuation would be both rather complex and unreliable (e.g. for
> ingredients containing no commas, periods or parentheses at all), so I'm
> instead using Python's textwrap capabilities (which we're already using
> for line-wrapping recipe instructions and notes), and which should break
> lines "softly" at whitespace characters to ensure lines are shorter than
> 39 characters.
>
> I'd be grateful if you could give this new version of the MM exporter
> another try as you did with the last iteration. While I've meanwhile
> also installed MM in a Dosbox on my Ubuntu, my test recipes are mostly
> German language and seem to feature units that MM doesn't understand
> easily (or maybe it's the diacritics).
>
> (One thing I've noticed is that even though MM specs require ingredient
> lines end at column 39, I think that it sometimes does successfully
> import longer lines as ingredients, such as in the Almond Crunch Granola
> recipe file (almgran2.mmf) you sent me earlier, where " 1 2/3 c oat
> flakes and wheat flakes, mixed" is 45 characters wide. Am I mistaken
> here?)
>
> Bernhard
>

Revision history for this message
Bernhard Reiter (ockham-razor) said :
#14

As for 1., I'm all for it, and have already fixed it:
https://github.com/thinkle/gourmet/commit/2c15490ccc1f41f3a675ca775d1eb3788aec3ceb

As for 2., I'll look into that.

Can you help with this problem?

Provide an answer of your own, or ask Charlie Figura for more information if necessary.

To post a message you must log in.