veekun / pokedex

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

Tags [something]{foo:bar} on descriptions? #286

Open Hugo-Matias opened 4 years ago

Hugo-Matias commented 4 years ago

I'm sorry about the title but that's the best name I could come up with, hopefully you guys understand.

There are some tags in descriptions text's that i assume are site related for hyperlinking or icon displaying for certain keywords like types, mechanics, etc. What are those tags?

I'm building a pokedex desktop app in python with pyqt5 as a learning project and would like to use those descriptions (abilities_prose->short_effect for instance) but i'm struggling to find a way to clean them.

I tried regex but the results were unsatisfactory due to irregular patterns like: []{type:fire} and [stage]{mechanic:stat-modifier} In the first case I would need the word enclosed with {} after fire: on the second case the correct word would be the one inside [].

encukou commented 4 years ago

This is Markdown syntax (with custom links). In case the label (thing inside []) is empty, you should use the name of the thing linked to. See the docstring in pokedex/db/markdown.py. The file also has classes with as_text and as_html methods that you can use.