$smwgParserFeatures

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgParserFeatures
Description Sets the behaviour of features related to text and annotation parsing
Default setting See below
Software Semantic MediaWiki
Since version
Until version still available
Configuration Interface settings
Keyword annotation · displaying values · interface


$smwgParserFeatures is a configuration parameter that sets the behaviour of the features related to the parsing of annotations on pages. The configuration parameter was introduced in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x.1 and deprecated the configuration parameters as indicated in the section on available options below.

Starting with Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. this parameter accepts an array of plain string keys instead of the SMW_PARSER_* constants. The constant form still works but is deprecated and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki..2

Default setting[edit]

$smwgParserFeatures = [ 'strict', 'inline-errors', 'hidden-categories' ];

This means that the three respective features as explained in the following sections on available options are enabled.

Available options[edit]

The options enabled by default are highlighted bold.
  • 'strict' (formerly SMW_PARSER_STRICT) – Sets that strictness should be enforced during the parsing of annotations on pages
NoteNote: This option replaces configuration parameter $smwgEnabledInTextAnnotationParserStrictModeSets whether strictness should be enforced during the annotation parsing process.
  • 'inline-errors' (formerly SMW_PARSER_INL_ERROR) – Sets that warnings are displayed in wikitext right after the problematic input in annotations
NoteNote: This option replaces configuration parameter $smwgInlineErrorsSets whether warnings should be shown right after problematic annotations.
  • 'hidden-categories' (formerly SMW_PARSER_HID_CATS) – Sets that categories marked with the __HIDDENCAT__ behaviour switch are omitted from the annotation process.
NoteNote: This option replaces configuration parameter $smwgShowHiddenCategoriesSets whether to omit categories marked with the HIDDENCAT behaviour switch from the annotation process.
  • 'unstrip' (formerly SMW_PARSER_UNSTRIP) – Sets that strip markers for properties of datatype "Text"Holds text of arbitrary length may be stored within property values
NoteNote: This option replaces configuration parameter $smwgDecodeTextAnnotationWithStripMarkerSets whether strip markers for properties of datatype "Text" may be stored within property values.
  • 'links-in-values' (formerly SMW_PARSER_LINKS_IN_VALUES, alias SMW_PARSER_LINV) – Sets that parsing of links in values for properties of datatype "Text"Holds text of arbitrary length is supported
NoteNote: This option replaces configuration parameter $smwgLinksInValuesSets whether internal links in values for properties of datatype "Text" may be stored within property values.
For further information on the available options listed above see the documentation pages of the respective deprecated configuration parameters as stated above.

Changing the default setting[edit]

To modify the setting to this configuration parameter, add one of the following lines to your "LocalSettings.php" file:

Removing a specific feature related to the parsing of annotations on pages

To disable a specific feature e.g. that hidden categories should not be shown just redefine the configuration parameter without including the corresponding string as shown in the above section on available options:

$smwgParserFeatures = [ 'strict', 'inline-errors' ];
Adding or removing the 'hidden-categories' option of this configuration parameter requires maintenance script "rebuildData.php"Allows to rebuild all the semantic data for a selected data backend/store to be run.
Adding a specific feature related to the parsing of annotations on pages

To enable a specific feature e.g. that strip markers for properties of datatype "Text"Holds text of arbitrary length may be stored within property values just redefine the configuration parameter including the corresponding string as shown in the above section on available options:

$smwgParserFeatures = [ 'strict', 'inline-errors', 'hidden-categories', 'unstrip' ];
Disabling all features related to the parsing of annotations on pages

To disable all features related to the parsing of annotations on pages set an empty array:

$smwgParserFeatures = [];

Legacy constant form (deprecated since 7.0.0)[edit]

The constant form below is deprecated since Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki.. Use the string-array form shown above instead. It is documented here for wikis still running the constant form.

The default expressed with constants:

$smwgParserFeatures = SMW_PARSER_STRICT | SMW_PARSER_INL_ERROR | SMW_PARSER_HID_CATS;

A specific feature can be removed with a bit-operation, e.g.:

$smwgParserFeatures = ( $smwgParserFeatures & ~SMW_PARSER_HID_CATS );
NoteNote: Please use parentheses3 when combining different bit-operations to avoid a possible mismatch.

To disable all parsing features with the constant form, use SMW_PARSER_NONE:

$smwgParserFeatures = SMW_PARSER_NONE;
Adding or removing the 'hidden-categories' option of this configuration parameter requires maintenance script "rebuildData.php"Allows to rebuild all the semantic data for a selected data backend/store to be run. This requirement is not applicable to all other options to this configuration parameter.

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:2802
  2. ^  | | | | | | | | |  Semantic MediaWiki: GitHub pull request gh:smw:6793
  3. ^  Bitwise Operators to use parentheses to ensure the desired precedence ...