''',
+ title=title,
+ rel_css=relative_css_path.rstrip('/'),
+ def_css=default_css
+ )
def set_menu_separator(self, relative_image_path):
"""Sets the menu separator.
@@ -86,9 +80,7 @@ class DocsWriter:
self.write('')
if link:
- self.write('')
+ self.write('', link)
# Write the real menu entry text
self.write(name)
@@ -107,26 +99,21 @@ class DocsWriter:
"""Writes a title header in the document body,
with an optional depth level
"""
- self.write('' % level)
- self.write(title)
- self.write(' ' % level)
+ self.write('{title} ', title=title, level=level)
def write_code(self, tlobject):
"""Writes the code for the given 'tlobject' properly
formatted with hyperlinks
"""
- self.write('
---') - self.write('functions' if tlobject.is_function else 'types') - self.write('---\n') + self.write('---{}---\n', + 'functions' if tlobject.is_function else 'types') # Write the function or type and its ID if tlobject.namespace: self.write(tlobject.namespace) self.write('.') - self.write(tlobject.name) - self.write('#') - self.write(hex(tlobject.id)[2:].rjust(8, '0')) + self.write('{}#{:08x}', tlobject.name, tlobject.id) # Write all the arguments (or do nothing if there's none) for arg in tlobject.args: @@ -143,20 +130,19 @@ class DocsWriter: # "Opening" modifiers if arg.is_flag: - self.write('flags.%d?' % arg.flag_index) + self.write('flags.{}?', arg.flag_index) if arg.is_generic: self.write('!') if arg.is_vector: - self.write( - 'Vector<' % self.type_to_path('vector') - ) + self.write('Vector<', + self.type_to_path('vector')) # Argument type if arg.type: if add_link: - self.write('' % self.type_to_path(arg.type)) + self.write('', self.type_to_path(arg.type)) self.write(arg.type) if add_link: self.write('') @@ -185,19 +171,14 @@ class DocsWriter: # use a lower type name for it (see #81) vector, inner = tlobject.result.split('<') inner = inner.strip('>') - self.write('%s<' % vector) + self.write('{}<', + self.type_to_path(vector), vector) - self.write('%s' % inner) - - self.write('>') + self.write('{}>', + self.type_to_path(inner), inner) else: - self.write('%s' % tlobject.result) + self.write('{}', + self.type_to_path(tlobject.result), tlobject.result) self.write('') @@ -218,17 +199,13 @@ class DocsWriter: self.write('') if bold: self.write('') if link: - self.write('') + self.write('', link) # Finally write the real table data, the given text self.write(text) @@ -253,9 +230,7 @@ class DocsWriter: def write_text(self, text): """Writes a paragraph of text""" - self.write(' ') - self.write(text) - self.write('
') + self.write('{}
', text) def write_copy_button(self, text, text_to_copy): """Writes a button with 'text' which can be used @@ -282,16 +257,18 @@ class DocsWriter: 'c.select();' 'try{document.execCommand("copy")}' 'catch(e){}}' - '') + '' + ) - self.write('') - self.write(self._script) - self.write('') + self.write('{}