Version 15 (modified by 17 years ago) (diff) | ,
---|
A Tagging System for Trac
The TagsPlugin implements both a generic tagging engine, and frontends for the Wiki and ticket systems. An extra text entry box is added to the Wiki edit page for tagging Wiki pages, and ticket fields (you can configure which ones) are treated as tags for the ticket system.
The TagsPlugin was created by Muness Alrubaie, with contributions from Alec Thomas.
Obtaining and Installing
Follow the installation instructions?.
What are tags?
Tags are like hierarchically organized wiki entries, however with them you can categorize a wiki entry under multiple tags and not just under one hierarchy. You can then search for wiki entries categorized under a tag or a collection of tags. In other words, tags provide a faceted classification system for the Trac wiki.
As an added bonus, tags are linked to the wiki entry of the same name, allowing you to describe them explicitly under the wiki entry of the same name. This allows for a flexible means for establishing the context of wiki entries. Besides this, tags also make it incredibly easy to create todo? lists or indexes?.
Tags don't have to be predefined. As long as there are wiki entries categorized under a tag, it'll be automatically created.
Tags are similar to labels in gmail, tags in the social bookmark manager del.icio.us and Flickr. They are substantially different from Wikipedia categories, because tags are associated with wiki entries of the same name, whereas WikiMedia Categories are just indexes.
This implementation of wiki tagging is specific to Trac. To stay consistent with the way Trac names wiki entries, tags are case sensitive. Trac Hacks itself makes extensive use of tagging and is a good example of their use. Also, see http://lists.edgewall.com/archive/trac/2006-April/007646.html for an example of how Alec uses ListTagged to query tickets.
How do I apply tags?
To create a tag, follow these steps:
- Go to the wiki entry you want to tag.
- Click on Edit This Page
- Under Change information, Tag under:, enter the tags you want to categorize the entry under. Separate the tags by commas. Note that white spaces are currently not supported and will be replaced by commas.
- Click Save changes.
The wiki entry you edit is now categorized under the tags you specified.
How do I remove a tag from a wiki entry?
To remove a tag from a wiki entry
- Go to the wiki entry you want to untag.
- Click on Edit This Page
- Under Change information, Tag under:, remove the tag from the list.
- Click Save changes.
Using the tags
Querying is implemented through the /tags uri handler, the tag:<tag>
syntax or Trac Macros as follows
/tags handler
Going to /tags under your project will show a list of all tags in the wiki. /tags/<tag> will show all the objects tagged <tag>. e.g. http://muness.textdriven.com/trac/tags/Java,Examples. This accepts all the parameters that the ListTagged macro does. e.g. http://muness.textdriven.com/trac/tags/Java,Examples?operation=union&amp;showheadings=true.
tagged:<tag>
Usage
Using tagged:<tag>
will link to the wiki <tag>. If that doesn't exist, it will instead link to a listing of all the objects tagged <tag>.
e.g. tagged:todo? or tagged:Java,Examples? . This syntax accepts all the options that the ListTagged macro does. e.g. tagged:Java,Examples?operation=union? .
Tag expressions
Both the ListTagged
macro and the /tags
handler use a basic expression language for filtering tagged objects.
Operators supported by the language are:
Operator | Function |
+ or , | Logical and
|
- | Logical and not
|
unary - | Not |
| | Logical or
|
Sub-expressions can be grouped inside parentheses (
, )
.
Tags can be quoted with single '
or double ''
quotes, in case they contain characters that are operators.
Examples
Intersection of Java
and Examples
tags:
Union of Java
and Examples
tags:
Objects tagged Java
or Python
, and Examples
tagged:(Java|Python)+Examples
Macro Usage
ListTagged
[[ListTagged]]
List tagged resources.
Usage:
[[ListTagged(<query>[,exclude=<list>],[[format=<format>],cols=<columns>])]]
- format
- result list presentation; supported values:
compact
comma-separated inline list of "linked-description" oldlist
(default)" * linked-id description (tags)" list table
table... (see corresponding column option too) short
or other valuebulleted list of "linked-description"
- cols
- columns for 'table' format using a "|"-separated list of column names (order matters); supported columns: realm, id, description, tags
- exclude
- exclude tagged resources that match a name in the colon-separated list of resource ids, accepts shell-style patterns
See tags documentation for the query syntax.
[[TagCloud]]
Display a tag cloud.
Show a tag cloud for all tags on resources matching query.
Usage:
[[TagCloud(<query>[,caseless_sort=<bool>][,mincount=<n>])]]
- caseless_sort
- Whether the tag cloud should be sorted case-sensitive.
- mincount
- Optional integer threshold to hide tags with smaller count.
See tags documentation for the query syntax.
ListTags
TagCloud
[[ListTagged]]
List tagged resources.
Usage:
[[ListTagged(<query>[,exclude=<list>],[[format=<format>],cols=<columns>])]]
- format
- result list presentation; supported values:
compact
comma-separated inline list of "linked-description" oldlist
(default)" * linked-id description (tags)" list table
table... (see corresponding column option too) short
or other valuebulleted list of "linked-description"
- cols
- columns for 'table' format using a "|"-separated list of column names (order matters); supported columns: realm, id, description, tags
- exclude
- exclude tagged resources that match a name in the colon-separated list of resource ids, accepts shell-style patterns
See tags documentation for the query syntax.
[[TagCloud]]
Display a tag cloud.
Show a tag cloud for all tags on resources matching query.
Usage:
[[TagCloud(<query>[,caseless_sort=<bool>][,mincount=<n>])]]
- caseless_sort
- Whether the tag cloud should be sorted case-sensitive.
- mincount
- Optional integer threshold to hide tags with smaller count.
See tags documentation for the query syntax.
Note that the macro argument defaults can be customized site-wide. See the installation instructions? and examples for details.
Attachments (2)
-
transifex_top-translations_tractags-0.7_chart.png (13.8 KB) - added by 10 years ago.
coverage of translations per language for v0.7
-
tags_example.png (69.7 KB) - added by 3 years ago.
Screenshot of tags from a wiki page
Download all attachments as: .zip