mirror of
https://github.com/matrix-org/matrix-spec
synced 2025-12-26 19:08:38 +01:00
Merge branch 'master' into daniel/threepidinvites-2
This commit is contained in:
commit
147ed4968d
|
|
@ -76,12 +76,14 @@ def main():
|
|||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 1 and sys.argv[1:] != ["--nodelete"]:
|
||||
# we accept no args, so they don't know what they're doing!
|
||||
# we accept almost no args, so they don't know what they're doing!
|
||||
print "gendoc.py - Generate the Matrix specification as HTML."
|
||||
print "Usage:"
|
||||
print " python gendoc.py"
|
||||
print " python gendoc.py [--nodelete]"
|
||||
print ""
|
||||
print "The specification can then be found in the gen/ folder."
|
||||
print ("If --nodelete was specified, intermediate files will be "
|
||||
"present in the tmp/ folder.")
|
||||
print ""
|
||||
print "Requirements:"
|
||||
print " - This script requires Jinja2 and rst2html (docutils)."
|
||||
|
|
|
|||
|
|
@ -76,6 +76,11 @@ def main(input_module, file_stream=None, out_dir=None, verbose=False):
|
|||
return " "*indent + input
|
||||
|
||||
def wrap(input, wrap=80, initial_indent=""):
|
||||
if len(input) == 0:
|
||||
return initial_indent
|
||||
# TextWrapper collapses newlines into single spaces; we do our own
|
||||
# splitting on newlines to prevent this, so that newlines can actually
|
||||
# be intentionally inserted in text.
|
||||
input_lines = input.split('\n\n')
|
||||
wrapper = TextWrapper(initial_indent=initial_indent, width=wrap)
|
||||
output_lines = [wrapper.fill(line) for line in input_lines]
|
||||
|
|
|
|||
Loading…
Reference in a new issue