wtfpython-web
wtfpython-web copied to clipboard
Parsing the README
The file https://raw.githubusercontent.com/satwikkansal/wtfpython/master/README.md needs to be parsed into some standard format (XML/JSON). This can be done by different ways
- Using some markdown parser in python, or by converting markdown to html and then using some HTML parser in python..
- Using regexes
- Using some complex if-else structure, fwiw I used https://github.com/satwikkansal/wtfpython/blob/master/irrelevant/parse_readme.py last time (the code no longer works, but hints can be taken from there)
Following needs to be extracted for every example in wtfpython
- Title
- Code to set up the examples (one or more snippets containing functions, or assignment expressions)
- Triggering code with results (statements which when run are expected to give some surprising results). Ideally this part contains trigger statements, output results, python versions for which output is valid (default value is all), and optionally a funny/sarcastic one liner about the unexpected output.
- Explanation: Explanation are in the form of points with optional Code snippets (like before) wherever required.
Some examples may not be strictly abiding to this structure, but this can be fixed easily if required for our project.