25 lines
417 B
Python
25 lines
417 B
Python
|
import markup
|
||
|
import wikipedia_api
|
||
|
|
||
|
def main():
|
||
|
links = []
|
||
|
while True:
|
||
|
try:
|
||
|
go = input('go> ')
|
||
|
except (EOFError, KeyboardInterrupt):
|
||
|
break
|
||
|
|
||
|
if go[:1] == '!':
|
||
|
page = go[1:]
|
||
|
else:
|
||
|
# Links are 1-indexed
|
||
|
page = links[markup.debase26(go) - 1]
|
||
|
|
||
|
wikitext = wikipedia_api.wikitext(page)
|
||
|
rendered, references, links = markup.render(wikitext)
|
||
|
|
||
|
print(rendered)
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|