##// END OF EJS Templates
updated documentation on display formatters
Greg Caporaso -
Show More
@@ -148,25 +148,29 b' class FileLinks(FileLink):'
148 148 See the FileLink (baseclass of LocalDirectory) docstring for
149 149 information on additional parameters.
150 150
151 notebook_display_formatter : func passed to os.path.walk when
152 formatting links for display in the notebook. This function
153 should be of the form: f(dirname, fnames) where dirname is the
154 name of a directory (a string) and fnames is a list of the
155 files in that directory (not including subdirectories) and
156 returns a list of lines that should be used to print that text
157 in the notebook. This function is iterated over for each
158 directory in self.path. A default formatter is in place, but
159 a function can be passed to support alternative formatting.
151 notebook_display_formatter : func used to format links for display
152 in the notebook. See discussion of formatter function below.
160 153
161 terminal_display_formatter : func passed to os.path.walk when
162 formatting links for display in the terminal. This function
163 should be of the form: f(dirname, fnames) where dirname is the
164 name of a directory (a string) and fnames is a list of the
165 files in that directory (not including subdirectories) and
166 returns a list of lines that should be used to print that text
167 in the terminal. This function is iterated over for each
168 directory in self.path. A default formatter is in place, but
169 a function can be passed to support alternative formatting.
154 terminal_display_formatter : func used to format links for display
155 in the terminal. See discussion of formatter function below.
156
157
158 Passing custom formatter functions
159 ----------------------------------
160 Formatter functions must be of the form:
161 f(dirname, fnames, included_suffixes)
162 dirname : the name of a directory (a string),
163 fnames : a list of the files in that directory
164 included_suffixes : a list of the file suffixes that should be
165 included in the output (passing None means
166 to include all suffixes in the output in
167 the built-in formatters)
168
169 returns a list of lines that should will be print in the
170 notebook (if passing notebook_display_formatter) or the terminal
171 (if passing terminal_display_formatter). This function is iterated
172 over for each directory in self.path. Default formatters are in
173 place, can be passed here to support alternative formatting.
170 174
171 175 """
172 176 self.included_suffixes = included_suffixes
@@ -187,8 +191,10 b' class FileLinks(FileLink):'
187 191 dirname_output_format,
188 192 fname_output_format,
189 193 fp_format):
190 """ generate function to format output- the resulting function will
191 take a list to be populated with the output lines to print,
194 """ generate built-in formatter function
195
196 this is used to define both the notebook and terminal built-in
197 formatters as they only differ by some wrapper text for each entry
192 198
193 199 dirname_output_format: string to use for formatting directory
194 200 names, dirname will be substituted for a single "%s" which
General Comments 0
You need to be logged in to leave comments. Login now