| 7 | // |
| 8 | // For the custom operator handling in statements like {% if ghes > 3.0 %}, see `lib/liquid-tags/if-ver.js`. |
| 9 | export default function shortVersions(req, res, next) { |
| 10 | const { allVersions, currentVersion } = req.context |
| 11 | const currentVersionObj = allVersions[currentVersion] |
| 12 | if (!currentVersionObj) return next() |
| 13 | |
| 14 | // Add the short name to context. |
| 15 | req.context[currentVersionObj.shortName] = true |
| 16 | |
| 17 | // Add convenience props. |
| 18 | req.context.currentVersionObj = currentVersionObj |
| 19 | req.context.currentRelease = currentVersion.split('@')[1] |
| 20 | req.context.currentVersionShortName = currentVersionObj.shortName |
| 21 | |
| 22 | return next() |
| 23 | } |