Fix docs generating invalid links for Vector results (#87)

This commit is contained in:
Lonami Exo 2017-05-19 10:01:58 +02:00
parent 41d1dac1c6
commit 57d99eabbb

View File

@ -1,4 +1,5 @@
import os
import re
class DocsWriter:
@ -153,9 +154,25 @@ class DocsWriter:
# Generic results cannot have any link
self.write(tlobject.result)
else:
self.write('<a href="')
self.write(self.type_to_path(tlobject.result))
self.write('">%s</a>' % tlobject.result)
if re.search('^vector<', tlobject.result, re.IGNORECASE):
# Notice that we don't simply make up the "Vector" part,
# because some requests (as of now, only FutureSalts),
# use a lower type name for it (see #81)
vector, inner = tlobject.result.split('<')
inner = inner.strip('>')
self.write('<a href="')
self.write(self.type_to_path(vector))
self.write('">%s</a>&lt;' % vector)
self.write('<a href="')
self.write(self.type_to_path(inner))
self.write('">%s</a>' % inner)
self.write('&gt;')
else:
self.write('<a href="')
self.write(self.type_to_path(tlobject.result))
self.write('">%s</a>' % tlobject.result)
self.write('</pre>')