1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
<?php
/**
* Registry of flags used with ParserOutput::setOutputFlag() within
* MediaWiki core.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @since 1.38
*
* @file
* @ingroup Parser
*/
namespace MediaWiki\Parser;
/**
* Registry of flags used with ParserOutput::{get,set}OutputFlag() within
* MediaWiki core.
*
* All flags used should be defined in this class.
*
* It is recommended that new flag names in core should begin with 'mw-'
* in order to prevent namespace conflicts with legacy flags.
*
* @package MediaWiki\Parser
*/
class ParserOutputFlags {
// These flags are currently stored as ParserOutput properties
/**
* @var string No gallery on category page? (__NOGALLERY__).
* @see ParserOutput::getNoGallery()
* @see ParserOutput::setNoGallery()
*/
public const NO_GALLERY = 'mw-NoGallery';
/**
* @var string Whether OOUI should be enabled.
* @see ParserOutput::getEnableOOUI()
* @see ParserOutput::setEnableOOUI()
*/
public const ENABLE_OOUI = 'mw-EnableOOUI';
/**
* @var string Force index policy to be 'index'
* @see ParserOutput::getIndexPolicy()
* @see ParserOutput::setIndexPolicy()
*/
public const INDEX_POLICY = 'mw-IndexPolicy';
/**
* @var string Force index policy to be 'noindex'
* @see ParserOutput::getIndexPolicy()
* @see ParserOutput::setIndexPolicy()
*/
public const NO_INDEX_POLICY = 'mw-NoIndexPolicy';
/**
* @var string Show a new section link?
* @see ParserOutput::getNewSection()
* @see ParserOutput::setNewSection()
*/
public const NEW_SECTION = 'mw-NewSection';
/**
* @var string Hide the new section link?
* @see ParserOutput::getHideNewSection()
* @see ParserOutput::setHideNewSection()
*/
public const HIDE_NEW_SECTION = 'mw-HideNewSection';
/**
* @var string The prevent-clickjacking flag
* @see ParserOutput::getPreventClickjacking()
* @see ParserOutput::setPreventClickjacking()
*/
public const PREVENT_CLICKJACKING = 'mw-PreventClickjacking';
// These flags are stored in the ParserOutput::$mFlags array
/**
* @var string Show the table of contents in the skin? This is
* a /suggestion/ based on whether the TOC is "large enough"
* and other factors, and is intended mostly for skins which
* want to match the behavior of the traditional inline ToC.
*/
public const SHOW_TOC = 'show-toc';
/**
* @var string Suppress the table of contents in the skin?
* This reflects the use of the __NOTOC__ magic word in the
* article (possibly modified by __TOC__ or __FORCETOC__),
* and represents an explicit request from the author to
* hide the TOC.
*/
public const NO_TOC = 'no-toc';
/**
* @var string Suppress the section edit links?
* This reflects the ParserOptions::getSuppressSectionEditLinks()
* flag and affects the default value of `enableSectionEditLinks`
* in ParserOutput::getText().
*/
public const NO_SECTION_EDIT_LINKS = 'no-section-edit-links';
/**
* @var string Wrap section contents to allow collapsing them?
* This reflects the ParserOptions::getCollapsibleSections()
* flag.
*/
public const COLLAPSIBLE_SECTIONS = 'collapsible-sections';
/**
* @var string
*/
public const VARY_REVISION = 'vary-revision';
/**
* @var string Similar to VARY_REVISION, but used if we didn't
* guess the ID correctly. Informs the edit saving system that
* getting the canonical output after revision insertion requires
* a parse that used that exact revision ID.
*/
public const VARY_REVISION_ID = 'vary-revision-id';
/**
* @var string Similar to VARY_REVISION, but used if we didn't
* guess the timestamp correctly. Informs the edit saving system
* that getting the canonical output after revision insertion
* requires a parse that used an actual revision timestamp.
*/
public const VARY_REVISION_TIMESTAMP = 'vary-revision-timestamp';
/**
* @var string Similar to VARY_REVISION, but used if we didn't guess the
* content correctly.
*/
public const VARY_REVISION_SHA1 = 'vary-revision-sha1';
/**
* @var string Similar to VARY_REVISION
*/
public const VARY_REVISION_EXISTS = 'vary-revision-exists';
/**
* @var string Similar to VARY_REVISION, but used if we didn't guess the
* page id correctly. Informs the edit saving system that getting the
* canonical output after page insertion requires a parse that used that
* exact page id.
*/
public const VARY_PAGE_ID = 'vary-page-id';
/**
* @var string Similar to VARY_REVISION. Informs the edit saving
* system that getting the canonical output after revision
* insertion requires a parse that used the actual user ID.
*/
public const VARY_USER = 'vary-user';
/**
* @var string Used to avoid extremely stale user signature timestamps
* (T84843). Set if the signature wikitext contains another '~~~~' or
* similar (T230652).
*/
public const USER_SIGNATURE = 'user-signature';
/**
* @var string Set when the parse is done in "preview mode", in which
* case various shortcuts are taken to work around the fact that the
* parsed text does not yet have an actual revision ID, revision time,
* etc.
* @see ParserOptions::getIsPreview()
*/
public const IS_PREVIEW = 'is-preview';
public static function cases(): array {
return [
self::NO_GALLERY,
self::ENABLE_OOUI,
self::INDEX_POLICY,
self::NO_INDEX_POLICY,
self::NEW_SECTION,
self::HIDE_NEW_SECTION,
self::SHOW_TOC,
self::NO_TOC,
self::NO_SECTION_EDIT_LINKS,
self::COLLAPSIBLE_SECTIONS,
self::PREVENT_CLICKJACKING,
self::VARY_REVISION,
self::VARY_REVISION_ID,
self::VARY_REVISION_TIMESTAMP,
self::VARY_REVISION_SHA1,
self::VARY_REVISION_EXISTS,
self::VARY_PAGE_ID,
self::VARY_USER,
self::USER_SIGNATURE,
self::IS_PREVIEW,
];
}
}
|