Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" 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 '' |