Here is an example Foods Text file:
Example 6.1. A sample Foods Text file
#source:name:qty:unit:date:meal:group:comment:options #Options: x=exact match; i=ignore case /home/massysett/pantry-data/master:Milk, reduced fat, fluid, 2% milkfat, with added vitamin A:1.0:cup:2007-06-30:Breakfast:Cereal and Milk::x /home/massysett/pantry-data/master:Papayas:1 1/2:medium /home/massysett/pantry-data/master:blueberries, raw:5:oz:::::i
The first thing to notice is that you can begin
comments anywhere on a line with a hash mark,
#
. Pantry ignores any text after the
comment symbol. Here, the first two lines are handy
reminders of the syntax of the Foods Text file.
Colons separate the fields in the Foods Text file. If
you need to include a colon or a hash mark in a field,
you can precede it with a backslash,
\
. To include a backslash, precede it
with a backslash. A single backslash followed by any
character other than a backslash, colon, or hash mark
generates an error.
Here is what appears in each column of the Foods Text file:
x
is
specified in the options
column. The search is case-sensitive unless
i
is specified in the
options
column. After looking
up the food using the contents of this column
and the source
column, Pantry
changes the traits of the food according to the
following columns.x
is
specified in the options
column, and the search is case sensitive unless
i
is specified in the
options
column.date
trait for the new
food.meal
trait for the new
food.group
trait for the new
food.comment
trait for the
new food.x
specifies that the search for the food name and
for the unit must be an exact match, rather than
a regular expression. i
makes
searches case insensitive.If you only need to use some of the columns, you can leave out trailing columns. The only columns that you must specify are the first two, for the source and the food name.
You may have noticed that there is a column to set
most of the food's traits, but there is no column to set
the food's order
trait. This is
because Pantry automatically sets the food's
order
trait so that it is equal to
the line number of the food in the file, although it is
left-padded with zeroes so that it will equal four
digits.