Skip to content

Commit 472a9be

Browse files
committed
fix: allow spaces in review references
1 parent 9d71956 commit 472a9be

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ can be used as follows:
5656
5757
:pdg-review:`QCD; p5`
5858
59-
:pdg-listing:`QCD; p5`
60-
61-
:pdg-review:`QCD; p5`
59+
:pdg-review:`PDG2015; Quark Model; p.2`
6260
```
6361

6462
which will render in the HTML pages as:
@@ -73,8 +71,6 @@ which will render in the HTML pages as:
7371
>
7472
> [PDG2020, §QCD, p.5](https://pdg.lbl.gov/2020/reviews/rpp2020-rev-qcd.pdf#page=5)
7573
>
76-
> [PDG2020, §QCD, p.5](https://pdg.lbl.gov/2020/reviews/rpp2020-rev-qcd.pdf#page=5)
77-
>
78-
> [PDG2018](https://pdg.lbl.gov/2018/listings/rpp2018-list-K-zero.pdf)
74+
> [PDG2015, §Quark Model, p.2](https://pdg.lbl.gov/2015/reviews/rpp2015-rev-qcd.pdf#page=2)
7975
8076
_Note that the resulting links lead to the correct page as well!_

src/sphinxcontrib/hep/pdgref/url.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def _create_listing_url(entry: PDGEntry) -> str:
3737
def _create_review_url(entry: PDGEntry) -> str:
3838
section_url = entry.section
3939
section_url = section_url.lower()
40+
section_url = section_url.replace(" ", "-")
4041
url = URLPattern.REVIEW.format(entry.year, section_url) # type: ignore
4142
url += __create_page_anchor(entry)
4243
return url

tests/roots/test-dummy/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
:pdg-listing:`pi-plus-minus; 2018`
44

5+
:pdg-review:`Quark Model; 2015; p.2`
6+
57
:pdg-review:`Kinematics`
68

79
:pdg-review:`QCD; p5`

tests/test_role.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def test_text(app, warning) -> None:
1313
assert lines[::2] == [
1414
f"PDG{DEFAULT_YEAR}",
1515
"PDG2018",
16+
"PDG2015, §Quark Model, p.2",
1617
f"PDG{DEFAULT_YEAR}, §Kinematics",
1718
f"PDG{DEFAULT_YEAR}, §QCD, p.5",
1819
"PDG2014, §Resonances",
@@ -30,6 +31,7 @@ def test_html(app, warning) -> None:
3031
assert [ref.text for ref in external_refs] == [
3132
f"PDG{DEFAULT_YEAR}",
3233
"PDG2018",
34+
"PDG2015, §Quark Model, p.2",
3335
"PDG2020, §Kinematics",
3436
"PDG2020, §QCD, p.5",
3537
"PDG2014, §Resonances",
@@ -38,6 +40,7 @@ def test_html(app, warning) -> None:
3840
assert [ref.get("href") for ref in external_refs] == [
3941
"https://pdg.lbl.gov/2020/listings/rpp2020-list-K-zero.pdf",
4042
"https://pdg.lbl.gov/2018/listings/rpp2018-list-pi-plus-minus.pdf",
43+
"https://pdg.lbl.gov/2015/reviews/rpp2015-rev-quark-model.pdf#page=2",
4144
"https://pdg.lbl.gov/2020/reviews/rpp2020-rev-kinematics.pdf",
4245
"https://pdg.lbl.gov/2020/reviews/rpp2020-rev-qcd.pdf#page=5",
4346
"https://pdg.lbl.gov/2014/reviews/rpp2014-rev-resonances.pdf",

0 commit comments

Comments
 (0)