Skip to content

Commit

Permalink
Merge pull request #37 from lpsinger/gcn3-urls
Browse files Browse the repository at this point in the history
Fix incorrect interpretation of .gcn3 file extensions
  • Loading branch information
jracusin authored May 28, 2024
2 parents d79fd9b + f5e172b commit f235460
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/replacements/gcn-circular/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const url = `${urlOrigin}/circulars/(${circularId})`

export default {
find: new RegExp(
`${url}|${legacyUrl}|${preamble}${circularId}(?:${conjunction}${circularId})*`,
`${url}|${legacyUrl}|(?<=^|\\s)(?:${preamble}${circularId}(?:${conjunction}${circularId})*)`,
'gi'
),
replace(data, value, circularIdFromUrl, circularIdFromLegacyUrl) {
Expand Down
3 changes: 2 additions & 1 deletion src/replacements/gcn-circular/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ <h1>Hello, world</h1>
<p>A legacy URL works too: <data class="gcn-circular" value="26640">https://gcn.gsfc.nasa.gov/gcn3/26640.gcn3</data></p>
<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>
<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>
<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>
<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>
<p>This is not a Circular: http://gcn.gsfc.nasa.gov/gcn/other/971227.gcn3</p>
9 changes: 9 additions & 0 deletions src/replacements/gcn-circular/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@
}
}
]
},
{
"type": "paragraph",
"children": [
{
"type": "text",
"value": "This is not a Circular: http://gcn.gsfc.nasa.gov/gcn/other/971227.gcn3"
}
]
}
]
}
2 changes: 2 additions & 0 deletions src/replacements/gcn-circular/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ And even really weird legacy URLs work: https://gcn.gsfc.nasa.gov/gcn/gcn/gcn/gc
GCN Circ. 789 and GCN Circs. 3 and 4

And this one refers to GCNs 1, 23a, 45.5 and 42

This is not a Circular: http://gcn.gsfc.nasa.gov/gcn/other/971227.gcn3

0 comments on commit f235460

Please sign in to comment.