download_tag.wmk
< use plugin="download_tag" />
< download file="filename.dat" [text="template"] />
This WebMake Perl library provides a quick shortcut to make links to files
for download.
The attributes supported are as follows:
-
file="filename.dat"
-
The filename to link to. If a file by this filename does not exist, a
warning will be printed.
Filenames should be specified relative to one of the following:
-
the top level of the site
-
-
the output file which contains the tag (not recommended, as it precludes
the tag being used in another output file in a different directory)
-
-
a directory named in the FileSearchPath WebMake option
-
text="template"
The link text to be used. The following content items are defined for use
inside the link text:
download.path
The real path to the file.
download.href
The path to the file, relative to the current output file.
download.name
The file's name, without directories.
download.mdate
The file's modification date, in ctime() format, e.g. Thu Mar 01 20:54:34
2001.
download.mtime
The file's modification date, in UNIX time_t format.
download.size_in_k
The file's size, in kilobytes (rounded up).
download.size
The file's size, in bytes.
download.owner
The file's owner.
download.group
The file's group.
download.tag_attrs
The remaining attributes of the download tag.
template can be, and should often be, a $ {content_reference}. The default template
is:
< a href="$ {download.href}" $ {download.tag_attrs}>$ {download.name}
($ {download.size_in_k}k)< /a>
Note that this means that any unrecognised attributes of the download tag
itself will become attributes of the A tag.
The default template can be overridden by setting the template content item
download.template .
FileSearchPath - WebMake option
|