[pmwiki-users] RFC: An improved (:attachlist:) - (:filelist:)

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Sat Mar 25 07:10:11 CST 2006

On Fri, 24 Mar 2006 christian.ridderstrom at gmail.com wrote:

Trying to get comments again... ,-)
Let me know if I should write this up as a PITS.

> Then I started thinking... the new (:pagelist:) is *really* powerful, 
> what if we could have something similar for attachments?
> Here is some of the basic functionality that I'd like to suggest. Please
> note that I'm not saying it necessarily should be implented using a single
> directive.
> * The core functionality is to generate a listing of files in a 
>   specified directory tree. 
> * The nesting level should be controllable, making it possible to only
>   list files in a single directory.
> * Some kind of filtering should be applied to the listing, just like
>   (:pagelist:) only lists pages matching the search criteria.
> -> This makes it possible to "find" a file...
> * It should be possible to choose the "format" of the listing, i.e.
>   control how much information is shown about each file.

As for controlling the format, I hope that a solution similar to that used
by (:pagelist:) is possible. Here's how it might be invoked:

	(:filelist /dir/subdir name='a*.txt' fmt=#myFormat:)

This should list files in '/dir/subdir/' (and any of its subdirectories)
that match the pattern 'a*.txt'. Each file should be shown using the
custom format 'myFormat'. This format would be defined at Site.FileList
within the anchors #myFormat and #myFormatEnd. Perhaps the section on that
page could look something like this:

	* {=$filelist-path}/{=$filelist-name}
	  ({=$filelist-size}, {=$filelist-date})

or if you'd like a link to the file (which you probably want...)

	* [[{=$filelist-name} -> {=$filelist-URI}]]

Here's an imagined custom format for showing a directory tree:

	(:if {=$filelist-isDir} and {=$filelist-level}=1:)
	* [[{=$filelist-name} -> {=$filelist-URI}]]
	(:if {=$filelist-isDir} and {=$filelist-level}=2:)
	** [[{=$filelist-name} -> {=$filelist-URI}]]
	(:if {=$filelist-isDir} and {=$filelist-level}=3:)
	*** [[{=$filelist-name} -> {=$filelist-URI}]]
	(:if {=$filelist-isDir} and {=$filelist-level}>4:)
	**** [[{=$filelist-name} -> {=$filelist-URI}]]

and here's an imagined custom format for showing only files in the tree

	(:if {=$filelist-isFile} and {=$filelist-level}=1:)
	* [[{=$filelist-name} -> {=$filelist-URI}]]
	(:if {=$filelist-isFile} and {=$filelist-level}=2:)
	** [[{=$filelist-name} -> {=$filelist-URI}]]
	(:if {=$filelist-isFile} and {=$filelist-level}=3:)
	*** [[{=$filelist-name} -> {=$filelist-URI}]]
	(:if {=$filelist-isFile} and {=$filelist-level}>4:)
	**** [[{=$filelist-name} -> {=$filelist-URI}]]

Let me know if you think (or don't think) about this kind of


PS. For now I'm skipping the advanced idea I had for allowing people to
create annotations associated with attachments.

Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr

More information about the pmwiki-users mailing list