Submenu parametric links
Submenu parametric link (or SMPL for short) is a lightweight method to add a few custom hyperlinks into the submenu of some pages.
SMPLs are "request-local": their existence and values are derived from the special parameters in the request's query string. The names of the query's parameters that are investigated and acted upon are formed by concatenation of the page-specific prefix and suffix "smplXY", where optional ending XY may vary (as explained below).
For the time of this writing, only /rptview
and /wiki
pages support SMPLs.
/rptview
pages recognize and respond to the query
parameters named "rvsmplXY"
, /wiki
pages - to the query parameters
named "wikismplXY"
.
In all cases, an optional ending XY consists of a digit X from the
set {1,2,3,4,5}
and an optional letter Y which (if present) must
be either 'a'
or 's'
(which are short for "alias"
and "skin"
respectively).
This variance enables to request several SMPLs "within" a single page.
It is suggested that parameters within URL aliases
end with letter 'a'
and parameters within custom skins'
headers/footers end with letter 's'
.
Parameters without Y are suggested for the general use within
the regular content of a repository.
The target of the hyperlink is always local to the repository:
it is formed by concatenation of a repository's base URL
with the value of the recognized parameter.
Parameter's value is well-formed if its first filepath segment
(separated by the first '/'
) has no strange characters (i.e. only
alphanumeric ASCII characters, dashes and the underscores '_'
are allowed).
Parameters that have malformed values are silently ignored.
The text (label) on the resulting submenu element equals to the value of the parameter modulus some prettification for better UX:
If a parameter's value starts with a lowercase letter and contains
'/'
then it goes unchanged into the user-visible label.- If the first letter is uppercase then the label is
truncated at the first
'/'
(if any), - otherwise the first letter is capitalized.
- If the first letter is uppercase then the label is
truncated at the first
Underscores in the first path segment are replaced with spaces.
If the resulting label starts with an uppercase letter then it is prepended with "✧" symbol for explicit distinction from the built-in labels.
See also
Exact algorithm is in function
style_submenu_parametric()
in filesrc/style.c
Forum thread 612170e31007 holds a brief discussion at the early stage of the idea.
About Unicode symbol "✧" (U+2727): unicode-table.com, unicode-symbol.com