metadata read fix in ponysay-tool + fix documentation on metadata

Signed-off-by: Mattias Andrée <maandree@operamail.com>
This commit is contained in:
Mattias Andrée 2013-04-06 23:24:17 +02:00
parent f86b16d702
commit fba2fbf862
2 changed files with 10 additions and 6 deletions

View file

@ -2379,11 +2379,15 @@ begins with a line with exactly 3 dollar signs and nothing else (@code{$$$}), an
end in the same way direct follow by the pony image starting from the next line.
A metadata tag consists of a tag name in upper case and a tag value, with a colon
(@code{:}), optionally with regular spaces or tab spaces. Multiple tag names can
be used multiple times or can be completely skipped. There are only a few tags,
namely @var{BALLOON TOP}, @var{BALLOON BOTTOM}, @var{MASTER}, @var{FREE}, that
absolutely should not be used muliple tag; a general rule is that a tag desribing
a pony should be duplicated exactly as many times as there are ponies in the image.
(@code{:}), optionally with surrounding regular spaces or tab spaces, but at least
one regular space or tab space directly after the colon. The name can only consist
of A to Z (upper case ASCII letters) and regular spaces. All tab spaces in the tag
names and values are handled as regular spaces. Multiple tag names can be used
multiple times or can be completely skipped. There are only a few tags, namely
@var{BALLOON TOP}, @var{BALLOON BOTTOM}, @var{MASTER} and @var{FREE}, that absolutely
should not be used muliple tag, but nor should @var{WIDTH} and @var{HEIGHT}; a
general rule is that a tag desribing a pony should be duplicated exactly as many
times as there are ponies in the image.
Any line that does not conform to the format of a tag line is a part of the comment
field. Leading line breaks in the comment field is ignored.

View file

@ -702,7 +702,7 @@ class PonysayTool():
data = {}
comment = []
for line in meta:
if ': ' in line:
if ': ' in line.replace('\t', ' '):
key = line.replace('\t', ' ')
key = key[:key.find(': ')]
test = key