1 2 3 4 5 6 8 10 11 12 13 15 17 18 19 21 22 23 27 28 30 32 33 34 35 47 49 50 52 |
""" Indentation utilities for Cog. http://nedbatchelder.com/code/cog
Copyright 2004-2009, Ned Batchelder. """
""" Determine the whitespace prefix common to all non-blank lines in the argument list. """ # Remove all blank lines from the list
# Find initial whitespace chunk in the first line. # This is the best prefix we can hope for.
# Loop over the other strings, keeping only as much of # the prefix as matches each string. prefix = prefix[:i] break
""" Take a block of text as a string or list of lines. Remove any common whitespace indentation. Re-indent using newIndent, and return it as a single string. """
""" Find the longest string that is a prefix of all the strings. """ return '' |