Fossil

Update of "branch/rptview-submenu-paralink"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 1dd6aa350f0e6cbe1c827ff0853770f7eed7f75897c91d4964577cca5ea118ae
Page Name:branch/rptview-submenu-paralink
Date: 2021-06-12 17:13:13
Original User: george
Mimetype:text/x-markdown
Parent: 774e0582130f0a3eecad6415a4d74c6b00c0cac2353539d5634b3864e51ac949
Content

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