Schema element "b:rules "
Set rules on a sub-set of the Units.
Definitions
<element name="rules" type="b:Rules"
substitutionGroup="b:native" />
<complexType name="Rules">
<complexContent>
<extension base="b:Native">
<sequence>
<element name="inherit" type="b:Fragment" [0..1] />
<element name="id_unwanted_chars" type="b:Expression" [0..1] />
<element name="id_encode_ascii" type="b:Expression" default="'[/]'" />
<element ref="b:path_split" [0..1] />
</sequence>
<attributeGroup ref="b:selector" />
</extension>
</complexContent>
</complexType>
Description
Be warned: id_unwanted_chars and
id_encode_ascii expect a formula: a plain regexp
must be encapsulated in single or double quotes.
element id_encode_ascii
When no id is given when a Unit is created, then one
is generated from its name . In the context, some of the
characters in the name may be dangerous: they play a role in the path
splitting or for any other reason.
The following characters are always encoded:
- '
': all sequences of WhiteSpace are compressed to a
single blank. The Unit's full path is a word, so that blank will
be encoded;
- '
: ': the colon is used after a prefix. Its use indicates
an absolute SCHEMA>b:UnitRef;
- '
# ': the fragment indictors, at the end of a
b:UnitRef ;
- '
\ ': the backslash, which is horribly confusing to
everyone; and
- '
% ': the encoding indicator.
Other characters to be encoded than these can be specified with this
element.
element id_unwanted_chars
When no id is given when a Unit is created, then one
is generated from its name . This elements contains a
regular expression for all characters and constructs which are to be
removed.
element inherit
Include all the settings from an other rule-set, by default from
the root set. This works recursively. The root rule-set will ignore
this parameter.
element path_split
The element explains how the relative
b:UnitRef path is to be interpreted. This path is
either
- a name within this Collection, or
- a name of a Unit which refers to a sub-collection, followed by a
path inside that sub-collection.
See b:path_split for the full details.
Examples
for id_unwanted_chars
Stripping characters: (mind the single/double quotes!)
'[: -]' # removed all colons, blanks, and dashes.
'( -> | [ ] | \.$ )' # remove ->, blanks, and trailing dots
'( \.tar\.gz | \.zip )$' # remove trailing .tar.gz and .zip
more complex use for id_unwanted_chars
More powerfull:
<unit uid="MyRules">
<type>ms:Type/Rules</type>
<rules when="unit.path like '/releases/*'">
<id_unwanted_chars>exts</id_unwanted_chars>
</rules>
<definitions>
<let name="is_tgz" regexp="\\.tar\.gz$" />
<let name="is_zip" regexp="\\.zip$" />
<let name="exts" expr="'(' ~ is_tgz ~ '|' ~ is_zip ~ ')'" />
</definitions>
</unit>
mark@overmeer.net
Web-pages generated on 2023-12-19
|