META:
macros
The default store engines store topics in plain-text files on disk, in a simple and obvious directory structure. The big advantage of this approach is that it makes it very easy to manipulate topics from outside Foswiki, and it is also very robust; there are no complex binary indexes to maintain, and moving a topic from one installation to another is as simple as copying a couple of text files.
To keep everything together in one place, meta-data (Foswiki-generated or from forms) is embedded directly in topics, using special macros. These macros are easy to spot, as they all start with the reservedMETA:
prefix.
META:
data includes information such as file attachments, topic movement history, and form field values. For efficiency reasons, the topic history is not stored in this meta-data, but is expected to be implemented elsewhere by the store engine.
%META:<type>{key1="value1" key2="value2" ...}%
%"\r\n{}
are encoded in argument values, using the standard URL encoding.
text of the topic %META:TOPICMOVED{from="Real.SecretAgents" to="Hollywood.SecretAgents" by="CoverUp" date="1655468868"}%
The following meta-data macros are supported by the Foswiki core. Other macros may be used by extensions; see the extension documentation for more details. The core will read and write these extension macros, but will otherwise ignore them.
Some fields are required by macros, while others are optional. Required fields are marked with a ® symbol. The ® character is not part of the attribute name.This macro caches some of the information that would normally be derived from the underlying store engine. It does this for efficiency reasons.
Key | Comment |
---|---|
author® | Canonical user identifier of last user to change the topic. The exact format of this depends on the user mapping manager. |
version | Topic version; a plain integer. |
date | epoch time |
format | Format of this topic, will be used for automatic format conversion |
reprev | Set when a revision is overwritten by the same author within the {ReplaceIfEditedAgainWithin} window (set in configure ). If reprev is the same as version , it prevents Foswiki from attempting to do a 3-way merge when merging overlapping edits by two different users. |
This only exists if the topic has been moved. If a topic is moved more than once, only the most recent META:TOPICMOVED meta datum exists in the topic. Older ones can to be found in the topic history.
%META:TOPICMOVED{from="Real.SecretAgents" to="Hollywood.SecretAgents" by="CoverUp" date="1416592876"}%
Key | Comment |
---|---|
from® | Full name, i.e., web.topic |
to® | Full name, i.e., web.topic |
by® | Canonical user identifier of who moved the topic. The exact format of this depends on the user mapping manager. |
date® | epoch time |
?
question mark link, or by filling out a form. The topic parent may also be manipulated in the user interface.
Key | Comment |
---|---|
name® | Normally just TopicName , but it can be a full Web.TopicName format if the parent is in a different Web. |
Reference to a file attached to this topic.
Key | Comment |
---|---|
name® | Name of file, no path. Must be unique within topic |
version | An integer |
path | Full path file was loaded from |
size | In bytes |
date | epoch time when the file was attached |
user | Canonical user identifier of user who uploaded the attachment. The exact format of this depends on the user mapping manager. |
comment | As supplied when file uploaded |
attr | h if hidden, optional |
Extra fields that are added if an attachment is moved:
Key | Comment |
---|---|
movedfrom | full topic name - web.topic.filename |
movedby | Canonical user identifier of user who moved the attachment. The exact format of this depends on the user mapping manager. |
movedto | full topic name - web.topic.filename |
movedwhen | epoch time |
Key | Comment |
---|---|
name® | The name of the topic containing the form definition. Can optionally include the web name (i.e., web.topic), but doesn't normally |
META:FORM
entry.
Key | Name |
---|---|
name® | Ties to entry in the form definition. This is the title with all characters except alphanumerics and . removed |
value® | Value user has supplied via form |
title | Full text from the form definition |
Key | Name |
---|---|
name® | Preference name |
value® | Preference value |
type | Set or Local (Set is the default) |
There is no absolute need for meta-data macros to be listed in a specific order within a topic, but it makes sense to do so, because form fields are displayed in the order they are defined when the topic is viewed.
The recommended sequence is:
META:TOPICINFO
META:TOPICPARENT
(optional)
META:TOPICMOVED
(optional)
META:FILEATTACHMENT
(0 or more entries)
META:FORM
(optional)
META:FIELD
(0 or more entries; FORM required)
META:PREFERENCE
(0 or more entries)
raw=debug
parameter to the URL to view the topic text with embedded meta-data, e.g: debug view for this topic. raw=all
lets you view the topic source as plain text, e.g: plain text view for this topic.
%META
%META
macro. See VarMETA for details.
%FORMFIELD
%FORMFIELD
macro lets you inspect the values of form field meta-data in other topics. See VarFORMFIELD for details.
%SEARCH
%SEARCH
can also be used to extract meta data. See VarSEARCH and the examples in FormattedSearch and SearchPatternCookbook.