Link to Local Attachments by Number
This macro allows to link to attachment of the current wiki or ticket by number, which is useful for generic pages etc.
Put the following code into your Trac configuration file trac.ini:
[components] tracattachmentnum.* = enabled [attachmentnum] # Optional default settings raw = True format = short # ATM format is only 'short' or 'long' (default)
[[AttachmentNum(1)]] # First attachment, result: "attachment:'first.doc'". [[AttachmentNum(1,raw=True)]] # First attachment (raw link), result: "raw-attachment:'first.doc'". [[AttachmentNum(1,format=short)]] # First attachment, hyper-linked filename is printed only, result: "first.doc".
If you have any issues, create a new ticket.
Download the zipped source from here.
Added encoding meta-comment and declared SVN keywords as unicode to avoid issues with non-english locales.
Removed outdated variable rev from setup file.
Removed import of source revisions to avoid installation issues.
- Updated code: use of trac.config API, use of second argument of cursor.execute, other minor improvements.
- Updated version number to v0.6. Minor typo fixes.