~kosova/+junk/tuxfamily-twiki

« back to all changes in this revision

Viewing changes to foswiki/data/System/MetaData.txt

  • Committer: James Michael DuPont
  • Date: 2009-07-18 19:58:49 UTC
  • Revision ID: jamesmikedupont@gmail.com-20090718195849-vgbmaht2ys791uo2
added foswiki

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%META:TOPICINFO{author="ProjectContributor" date="1231502400" format="1.1" version="1"}%
 
2
%STARTINCLUDE%
 
3
#MetaData
 
4
---+ Meta data
 
5
 
 
6
_Additional topic data, program-generated or from DataForms, is stored embedded in the topic text using =META:= tags_
 
7
 
 
8
%TOC%
 
9
 
 
10
---++ Overview
 
11
 
 
12
By default, topics are stored in files on disk, in a really simple and obvious directory structure. The big advantage of this approach is that it makes it really easy to manipulate topics from outside, and is also very safe; 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.
 
13
 
 
14
To keep eveything together in one place, meta-data (program-generated or from DataForms) is embedded directly in topics. It does this using =META:= tags.
 
15
 
 
16
=META:= data includes program-generated info like FileAttachment, topic movement data and user-defined information from DataForms.
 
17
 
 
18
---++ Meta data syntax
 
19
 
 
20
   * Format is the same as in [[%SYSTEMWEB%.Macros][macros]], except all fields have a key.
 
21
      * =%<nop>META:&lt;type&gt;{key1="value1" key2="value2" ...}%=
 
22
 
 
23
   * Order of fields within the meta-data is not defined, except that if there is a field with key =name=, this appears first for easier searching (note the order of the data themselves is defined).
 
24
 
 
25
   * Each meta-datum is on one line.
 
26
 
 
27
   * Values in meta-data are URL encoded so that characters such as \n can be stored.
 
28
 
 
29
<blockquote>
 
30
*Example of Format*
 
31
<pre>
 
32
%<nop>META:TOPICINFO{version="1.6" date="976762663" author="LastEditorWikiName" format="1.0"}%
 
33
   text of the topic
 
34
%<nop>META:TOPICMOVED{from="Codev.OldName" to="Codev.NewName"
 
35
   by="TopicMoverWikiName" date="976762680"}%
 
36
%<nop>META:TOPICPARENT{name="NavigationByTopicContext"}%
 
37
%<nop>META:FILEATTACHMENT{name="Sample.txt" version="1.3" ... }%
 
38
%<nop>META:FILEATTACHMENT{name="Smile.gif" version="1.1" ... }%
 
39
%<nop>META:FORM{name="WebFormTemplate"}%
 
40
%<nop>META:FIELD{name="OperatingSystem" value="OsWin"}%
 
41
%<nop>META:FIELD{name="TopicClassification" value="PublicFAQ"}%
 
42
</pre>
 
43
</blockquote>
 
44
 
 
45
---++ Meta data specifications
 
46
 
 
47
The current version of Meta Data is 1.0, with support for the following syntax.
 
48
 
 
49
---+++ META:TOPICINFO
 
50
 
 
51
|  *Key*  |  *Comment*          |
 
52
| version | Same as SVN version |
 
53
| date    | integer, unix time, seconds since start 1970 |
 
54
| author  | last to change topic, is the REMOTE_USER |
 
55
| format  | Format of this topic, will be used for automatic format conversion |
 
56
 
 
57
---+++ META:TOPICMOVED
 
58
 
 
59
This is optional, exists if topic has ever been moved. If a topic is moved more than once, only the most recent META:TOPICMOVED meta datum exists in the topic, older ones are to be found in the rcs history.
 
60
 
 
61
=%<nop>META:TOPICMOVED{from="Codev.OldName" to="Codev.NewName" by="talintj" date="976762680"}%=
 
62
 
 
63
|  *Key*  |  *Comment*          |
 
64
| from | Full name, i.e., web.topic |
 
65
| to   | Full name, i.e., web.topic |
 
66
| by   | Who did it, is the REMOTE_USER, not <nop>WikiName |
 
67
| date | integer, unix time, seconds since start 1970 |
 
68
 
 
69
Notes: 
 
70
   * at present version number is not supported directly, it can be inferred from the SVN history.
 
71
   * there is only one META:TOPICMOVED in a topic, older move information can be found in the SVN history.
 
72
 
 
73
---+++ META:TOPICPARENT
 
74
 
 
75
| *Key*   | *Comment* |
 
76
| name    | The topic from which this was created, typically when clicking on a =?= questionmark link, or by filling out a form.  Normally just =TopicName=, but it can be a full =Web.TopicName= format if the parent is in a different Web. |
 
77
 
 
78
---+++ META:FILEATTACHMENT
 
79
 
 
80
| *Key*   | *Comment* |
 
81
| name    | Name of file, no path.  Must be unique within topic |
 
82
| version | Same as SVN revision  |
 
83
| path    | Full path file was loaded from |
 
84
| size    | In bytes |
 
85
| date    | integer, unix time, seconds since start 1970 |
 
86
| user    | the REMOTE_USER, not <nop>WikiName |
 
87
| comment | As supplied when file uploaded |
 
88
| attr    | =h= if hidden, optional |
 
89
 
 
90
Extra fields that are added if an attachment is moved:
 
91
 
 
92
| *Key*   | *Comment* |
 
93
| movedfrom | full topic name - web.topic |
 
94
| movedby   | the REMOTE_USER, not <nop>WikiName |
 
95
| movedto   | full topic name - web.topic |
 
96
| moveddate | integer, unix time, seconds since start 1970 |
 
97
 
 
98
---+++ META:FORM
 
99
 
 
100
| *Key*   | *Comment* |
 
101
| name    | A topic name - the topic represents one of the DataForms.  Can optionally include the web name (i.e., web.topic), but doesn't normally |
 
102
 
 
103
---+++ META:FIELD
 
104
 
 
105
Should only be present if there is a META:FORM entry.  Note that this data is used when viewing a topic; the form definition is not read.
 
106
 
 
107
| *Key*   | *Name*   |
 
108
| name    | Ties to entry in DataForms template, is title with all bar alphanumerics and . removed |
 
109
| title   | Full text from DataForms template |
 
110
| value   | Value user has supplied via form |
 
111
 
 
112
---+++ Recommended sequence
 
113
 
 
114
There is no absolute need for Meta data to be listed in a specific order within a topic, but it makes sense to do so for a couple of good reasons:
 
115
 
 
116
   * form fields remain in the order they are defined
 
117
   * the =diff= function output appears in a logical order
 
118
 
 
119
The recommended sequence is:
 
120
 
 
121
   * =META:TOPICINFO=
 
122
   * =META:TOPICPARENT= (optional)
 
123
   * text of topic
 
124
   * =META:TOPICMOVED= (optional)
 
125
   * =META:FILEATTACHMENT= (0 or more entries)
 
126
   * =META:FORM= (optional)
 
127
   * =META:FIELD= (0 or more entries; FORM required)
 
128
 
 
129
---++ Viewing meta data in page source
 
130
 
 
131
When viewing a topic the ==[View raw text]== link can be clicked to show the text of a topic (i.e., as seen when editing).  This is done by adding <code>raw=on</code> to URL.  <code>raw=debug</code> shows the meta data as well as the topic data, ex: <a href="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%?raw=debug">debug view for this topic</a>
 
132
 
 
133
#MetaDataRendering
 
134
---++ Rendering meta data
 
135
 
 
136
Meta data is rendered with the %<nop>META% macro. This is mostly used in the =view=, =preview= and =edit= scripts.
 
137
 
 
138
You can render form fields in topic text by using the FORMFIELD macro. Example:%BR%
 
139
=%<nop>FORMFIELD{"TopicClassification"}%= %BR%
 
140
For details, see VarFORMFIELD.
 
141
 
 
142
Current support covers:
 
143
 
 
144
| *Macro usage:*   | *Comment:*  |
 
145
| =%<nop>META{"form"}%= | Show form data, see DataForms. |
 
146
| =%<nop>META{"formfield"}%= | Show form field value. Parameter: ==name="field_name"==. Example:%BR% =%<nop>META{ "formfield" name="TopicClassification" }%= |
 
147
| =%<nop>META{"attachments"}%= | Show attachments, except for hidden ones. Options: <br /> \
 
148
    ==all="on"==: Show all attachments, including hidden ones. |
 
149
| =%<nop>META{"moved"}%= | Details of any topic moves. |
 
150
| =%<nop>META{"parent"}%= | Show topic parent. Options: <br /> \
 
151
    ==dontrecurse="on"==: By default recurses up tree, at some cost. <br /> \
 
152
    ==nowebhome="on"==: Suppress <nop>%HOMETOPIC%. <br /> \
 
153
    ==prefix="..."==: Prefix for parents, only if there are parents, default =""=. <br /> \
 
154
    ==suffix="..."==: Suffix, only appears if there are parents, default =""=. <br /> \
 
155
    ==separator="..."==: Separator between parents, default is =" &gt; "=. |
 
156
 
 
157
%H% SEARCH can also be used to render meta data, see examples in FormattedSearch and SearchPatternCookbook.
 
158
 
 
159
---
 
160
*Related Topics:* DeveloperDocumentationCategory, UserDocumentationCategory