veekun / pokedex

more than you ever wanted to know about Pokémon
MIT License
1.45k stars 636 forks source link

Flavour text formatting? [Question] #164

Closed farbodsz closed 8 years ago

farbodsz commented 8 years ago

This is more a question than an issue, but I was looking at the pokemon_species_flavor_text.csv file, and it seems like descriptions are separated to multiple lines for some reason.

For example:

1,1,9,"A strange seed was
planted on its
back at birth.The plant sprouts
and grows with
this POKéMON."

Why is there a gap/newline between was and planted, its and back, etc. - is there a particular reason for this?

DrDos0016 commented 8 years ago

I believe this just matches the line breaks used in the games themselves.

farbodsz commented 8 years ago

@DrDos0016 Thanks for the quick reply.

Can the line breaks can be removed? Alternatively, when veekun reads this file, how does it concatenate the descriptions from different lines?

KamilaBorowska commented 8 years ago

Veekun uses \n to mark next line, and \f to mark a page. If you want to remove it for display purpoess, replace \n and \f with a space.

If you mean parsing this, use a proper CSV parser (linebreaks are allowed between quotes in CSV), don't parse it manually. Veekun itself uses SQL, CSV is just a storage for data that is going to be uploaded into a database using PostgreSQL's COPY command.