@@ -817,31 +817,31 @@ func issueIndexPatternProcessor(ctx *RenderContext, node *html.Node) {
817
817
818
818
next := node .NextSibling
819
819
820
- _ , exttrack := ctx .Metas ["format" ]
821
- notNumericStyle := ctx .Metas ["style" ] != IssueNameStyleNumeric
822
- foundNumeric , refNumeric := references .FindRenderizableReferenceNumeric (node .Data , exttrack && notNumericStyle )
823
-
824
820
for node != nil && node != next {
821
+ _ , hasExtTrackFormat := ctx .Metas ["format" ]
822
+
823
+ // Repos with external issue trackers might still need to reference local PRs
824
+ // We need to concern with the first one that shows up in the text, whichever it is
825
+ isNumericStyle := ctx .Metas ["style" ] == "" || ctx .Metas ["style" ] == IssueNameStyleNumeric
826
+ foundNumeric , refNumeric := references .FindRenderizableReferenceNumeric (node .Data , hasExtTrackFormat && ! isNumericStyle )
827
+
825
828
switch ctx .Metas ["style" ] {
826
- case IssueNameStyleNumeric :
827
- found = foundNumeric
828
- ref = refNumeric
829
+ case "" , IssueNameStyleNumeric :
830
+ found , ref = foundNumeric , refNumeric
829
831
case IssueNameStyleAlphanumeric :
830
832
found , ref = references .FindRenderizableReferenceAlphanumeric (node .Data )
831
833
case IssueNameStyleRegexp :
832
- // TODO: Compile only once, at regexp definition time
833
- pattern , err := regexp .Compile (ctx .Metas ["regexp" ])
834
- if err == nil {
834
+ pattern , err := regexp .Compile (ctx .Metas ["regexp" ]) // TODO: Compile only once, at regexp definition time
835
+ if err != nil {
835
836
return
836
837
}
837
838
found , ref = references .FindRenderizableReferenceRegexp (node .Data , pattern )
838
839
}
839
840
840
841
// Repos with external issue trackers might still need to reference local PRs
841
842
// We need to concern with the first one that shows up in the text, whichever it is
842
- if exttrack && notNumericStyle {
843
- // If numeric (PR) was found and it was BEFORE the notNumeric
844
- // pattern, use that
843
+ if hasExtTrackFormat && ! isNumericStyle {
844
+ // If numeric (PR) was found, and it was BEFORE the non-numeric pattern, use that
845
845
if foundNumeric && refNumeric .RefLocation .Start < ref .RefLocation .Start {
846
846
found = foundNumeric
847
847
ref = refNumeric
@@ -853,7 +853,7 @@ func issueIndexPatternProcessor(ctx *RenderContext, node *html.Node) {
853
853
854
854
var link * html.Node
855
855
reftext := node .Data [ref .RefLocation .Start :ref .RefLocation .End ]
856
- if exttrack && ! ref .IsPull {
856
+ if hasExtTrackFormat && ! ref .IsPull {
857
857
ctx .Metas ["index" ] = ref .Issue
858
858
859
859
res , err := vars .Expand (ctx .Metas ["format" ], ctx .Metas )
@@ -886,7 +886,7 @@ func issueIndexPatternProcessor(ctx *RenderContext, node *html.Node) {
886
886
887
887
// Decorate action keywords if actionable
888
888
var keyword * html.Node
889
- if references .IsXrefActionable (ref , exttrack ) {
889
+ if references .IsXrefActionable (ref , hasExtTrackFormat ) {
890
890
keyword = createKeyword (node .Data [ref .ActionLocation .Start :ref .ActionLocation .End ])
891
891
} else {
892
892
keyword = & html.Node {
0 commit comments