Skip to content

Commit f235460

Browse files
authored
Merge pull request #37 from lpsinger/gcn3-urls
Fix incorrect interpretation of .gcn3 file extensions
2 parents d79fd9b + f5e172b commit f235460

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/replacements/gcn-circular/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const url = `${urlOrigin}/circulars/(${circularId})`
1717

1818
export default {
1919
find: new RegExp(
20-
`${url}|${legacyUrl}|${preamble}${circularId}(?:${conjunction}${circularId})*`,
20+
`${url}|${legacyUrl}|(?<=^|\\s)(?:${preamble}${circularId}(?:${conjunction}${circularId})*)`,
2121
'gi'
2222
),
2323
replace(data, value, circularIdFromUrl, circularIdFromLegacyUrl) {

src/replacements/gcn-circular/test.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ <h1>Hello, world</h1>
44
<p>A legacy URL works too: <data class="gcn-circular" value="26640">https://gcn.gsfc.nasa.gov/gcn3/26640.gcn3</data></p>
55
<p>And even really weird legacy URLs work: <data class="gcn-circular" value="33567">https://gcn.gsfc.nasa.gov/gcn/gcn/gcn/gcn3/33567.gcn3</data></p>
66
<p>GCN Circ. <data class="gcn-circular" value="789">789</data> and GCN Circs. <data class="gcn-circular" value="3">3</data> and <data class="gcn-circular" value="4">4</data></p>
7-
<p>And this one refers to GCNs <data class="gcn-circular" value="1">1</data>, <data class="gcn-circular" value="23.5">23a</data>, <data class="gcn-circular" value="45.5">45.5</data> and <data class="gcn-circular" value="42">42</data></p>
7+
<p>And this one refers to GCNs <data class="gcn-circular" value="1">1</data>, <data class="gcn-circular" value="23.5">23a</data>, <data class="gcn-circular" value="45.5">45.5</data> and <data class="gcn-circular" value="42">42</data></p>
8+
<p>This is not a Circular: http://gcn.gsfc.nasa.gov/gcn/other/971227.gcn3</p>

src/replacements/gcn-circular/test.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@
200200
}
201201
}
202202
]
203+
},
204+
{
205+
"type": "paragraph",
206+
"children": [
207+
{
208+
"type": "text",
209+
"value": "This is not a Circular: http://gcn.gsfc.nasa.gov/gcn/other/971227.gcn3"
210+
}
211+
]
203212
}
204213
]
205214
}

src/replacements/gcn-circular/test.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ And even really weird legacy URLs work: https://gcn.gsfc.nasa.gov/gcn/gcn/gcn/gc
1111
GCN Circ. 789 and GCN Circs. 3 and 4
1212

1313
And this one refers to GCNs 1, 23a, 45.5 and 42
14+
15+
This is not a Circular: http://gcn.gsfc.nasa.gov/gcn/other/971227.gcn3

0 commit comments

Comments
 (0)