Skip to content

Commit 44d6a90

Browse files
emontytechknowlogick
authored andcommitted
Support n as a line highlight prefix (#5987)
We're working on rolling out gitea as a replacement for a fairly large cgit installation. Part of this involves a metric ton of mod_rewrite rules so that links people have out in the wild will still work. Unfortunately, cgit uses #n1 in the url to indicate a single line highlight, which doesn't get passed to the server and therefore can't be rewritten. We've got a local workaround by shoving a script block into a custom header template, but thought it might be nicer to upstream a simple patch to support #n as a prefix for single line highlights. (luckily for simplicity, cgit does not support ranges) Signed-off-by: Monty Taylor <[email protected]>
1 parent da1edbf commit 44d6a90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

public/js/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,9 +1602,9 @@ function initCodeView() {
16021602
$("html, body").scrollTop($first.offset().top - 200);
16031603
return;
16041604
}
1605-
m = window.location.hash.match(/^#(L\d+)$/);
1605+
m = window.location.hash.match(/^#(L|n)(\d+)$/);
16061606
if (m) {
1607-
$first = $list.filter('.' + m[1]);
1607+
$first = $list.filter('.L' + m[2]);
16081608
selectRange($list, $first);
16091609
$("html, body").scrollTop($first.offset().top - 200);
16101610
}

0 commit comments

Comments
 (0)