Notes About Branch rptview-submenu-paralink

Notes About Branch rptview-submenu-paralink

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:

  1. 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.
  2. Underscores in the first path segment are replaced with spaces.

  3. 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