Tagging
For easier navigation through document revisions, Webstrate includes tagging. A tag is a label applied to a specific version of the document.
All tags for a document can be seen by either accessing http://<hostname>/<webstrateId>?tags
or calling webstrate.tags()
in the Webstrate. The current tag can also be seen by calling webstrate.tag()
.
Listening for tagging and untagging can be done using the two events tag
and untag
:
webstrate.on("tag", function(version, label) {
// A version has been tagged with a label.
});
Subscribing to the untag
event is done in a similar fashion, except only a version
parameter will be given.
Manual tagging
Tagging can be done by calling webstrate.tag(label, [version])
. If no version is supplied, the current version will be used. A label can be any text string that does not begin with a number.
Restoring a document from a tag can be achieved by calling webstrate.restore(label)
.
A tag can be removed by calling webstrate.untag(label)
or webstrate.untag(version)
.
All labels are unique for each Webstrate (i.e. no two versions of the same document can carry the same label), and likewise each version can only have one label. Adding a label to a version that is already tagged will overwrite the existing tag. Adding a label that already exists on another version will move the tag to the new version.
Auto-tagging
In addition to manual tagging, Webstrates also automatically creates tags when a user starts modifying a document after a set period of inactivity. See tagging in the configuration section.