mirror of
https://github.com/git/git
synced 2024-08-27 03:29:21 +00:00
gitweb (SyntaxHighlighter): interpret #l<line-number>
It is pretty convenient to refer to a line number by appending, say, highlighter, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
610631e49c
commit
347b83c2c0
|
@ -6574,7 +6574,21 @@ sub git_blob {
|
||||||
$lang =~ s! (\S+)$! $brush_prefix$1!;
|
$lang =~ s! (\S+)$! $brush_prefix$1!;
|
||||||
print "'".$lang.qq!.js',!;
|
print "'".$lang.qq!.js',!;
|
||||||
}
|
}
|
||||||
print qq!''); SyntaxHighlighter.all();</script>!;
|
print qq!''); SyntaxHighlighter.all();!
|
||||||
|
.qq!function scrollTo(number) {!
|
||||||
|
.qq! var elements = document.getElementsByClassName(number);!
|
||||||
|
.qq! if (elements.length == 0) setTimeout('scrollTo("' + number + '");', 50);!
|
||||||
|
.qq! else {!
|
||||||
|
.qq! window.scroll(0, elements[0].offsetTop);!
|
||||||
|
.qq! window.scrollTo(0, elements[0].offsetTop);!
|
||||||
|
.qq! elements[0].style.color = '#ff0000';!
|
||||||
|
.qq! }!
|
||||||
|
.qq!}!
|
||||||
|
.qq!var lineRegex = /#l(\\d+)\$/;!
|
||||||
|
.qq!var lineNumber = lineRegex.exec(document.URL);!
|
||||||
|
.qq!if (lineNumber)!
|
||||||
|
.qq! scrollTo('number' + lineNumber[1]);!
|
||||||
|
.qq!</script>!;
|
||||||
} else {
|
} else {
|
||||||
my $nr;
|
my $nr;
|
||||||
while (my $line = <$fd>) {
|
while (my $line = <$fd>) {
|
||||||
|
|
Loading…
Reference in a new issue