Skip to content

Commit a723156

Browse files
committed
Fix to fine-tune URI link for Sh QSTRING
1 parent 029eb5b commit a723156

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/org/opensolaris/opengrok/analysis/sh/ShXref.lex

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ package org.opensolaris.opengrok.analysis.sh;
2727
import java.io.IOException;
2828
import java.util.Stack;
2929
import org.opensolaris.opengrok.analysis.JFlexXrefSimple;
30+
import org.opensolaris.opengrok.util.StringUtils;
3031
import org.opensolaris.opengrok.web.HtmlConsts;
3132
import org.opensolaris.opengrok.web.Util;
3233
%%
@@ -311,13 +312,20 @@ File = {FNameChar}+ "." ([a-zA-Z]+)
311312
}
312313

313314
<STRING, SCOMMENT, QSTRING> {
314-
315-
{BrowseableURI} {
316-
appendLink(yytext(), true);
317-
}
318-
319315
{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+
320316
{
321317
writeEMailAddress(yytext());
322318
}
323319
}
320+
321+
<STRING, SCOMMENT> {
322+
{BrowseableURI} {
323+
appendLink(yytext(), true);
324+
}
325+
}
326+
327+
<QSTRING> {
328+
{BrowseableURI} {
329+
appendLink(yytext(), true, StringUtils.APOS_NO_BSESC);
330+
}
331+
}

test/org/opensolaris/opengrok/analysis/sh/sample.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,4 @@ exit 0
267267

268268
typeset -i vint
269269
vint=0xFFEF
270+
echo 'http://example.com'

test/org/opensolaris/opengrok/analysis/sh/sample_xref.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,5 +275,6 @@
275275
<a class="l" name="267" href="#267">267</a>
276276
<a class="l" name="268" href="#268">268</a><b>typeset</b> -i <a href="/source/s?defs=vint" class="intelliWindow-symbol" data-definition-place="undefined-in-file">vint</a>
277277
<a class="l" name="269" href="#269">269</a><a href="/source/s?defs=vint" class="intelliWindow-symbol" data-definition-place="undefined-in-file">vint</a>=<span class="n">0xFFEF</span>
278-
<a class="hl" name="270" href="#270">270</a></body>
278+
<a class="hl" name="270" href="#270">270</a><b>echo</b> <span class="s">&apos;<a href="http://example.com">http://example.com</a>&apos;</span>
279+
<a class="l" name="271" href="#271">271</a></body>
279280
</html>

0 commit comments

Comments
 (0)