[go: up one dir, main page]

Skip to content

Add compatibility for cgit fragments

From https://gitlab.gnome.org/Infrastructure/GitLab/issues/126

The link: http://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/common/gsd-input-helper.c#n287 Redirects to: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/blob/master/plugins/common/gsd-input-helper.c#n287

The fragment cannot however be rewritten, and is in the wrong format for the GitLab viewer to use, so it doesn't scroll to the line: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/blob/master/plugins/common/gsd-input-helper.c#L287

The easiest way to fix this would be to have the GitLab source viewer create both "nXXX" and "LXXX" anchors in the HTML so > that line references still work

This Javascript one-liner mentioned by Shaun on the original issue would fix the problem:

if (/^#n\d+$/.test(location.hash)) { location.hash = '#L' + location.hash.slice(2); }