diff --git a/README.md b/README.md index 8bb33c4..ee8526d 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,7 @@ can be used as follows: :pdg-review:`QCD; p5` -:pdg-listing:`QCD; p5` - -:pdg-review:`QCD; p5` +:pdg-review:`PDG2015; Quark Model; p.2` ``` which will render in the HTML pages as: @@ -73,8 +71,6 @@ which will render in the HTML pages as: > > [PDG2020, §QCD, p.5](https://pdg.lbl.gov/2020/reviews/rpp2020-rev-qcd.pdf#page=5) > -> [PDG2020, §QCD, p.5](https://pdg.lbl.gov/2020/reviews/rpp2020-rev-qcd.pdf#page=5) -> -> [PDG2018](https://pdg.lbl.gov/2018/listings/rpp2018-list-K-zero.pdf) +> [PDG2015, §Quark Model, p.2](https://pdg.lbl.gov/2015/reviews/rpp2015-rev-qcd.pdf#page=2) _Note that the resulting links lead to the correct page as well!_ diff --git a/src/sphinxcontrib/hep/pdgref/url.py b/src/sphinxcontrib/hep/pdgref/url.py index f23f6b9..b39ee46 100644 --- a/src/sphinxcontrib/hep/pdgref/url.py +++ b/src/sphinxcontrib/hep/pdgref/url.py @@ -37,6 +37,7 @@ def _create_listing_url(entry: PDGEntry) -> str: def _create_review_url(entry: PDGEntry) -> str: section_url = entry.section section_url = section_url.lower() + section_url = section_url.replace(" ", "-") url = URLPattern.REVIEW.format(entry.year, section_url) # type: ignore url += __create_page_anchor(entry) return url diff --git a/tests/roots/test-dummy/index.rst b/tests/roots/test-dummy/index.rst index 0a7d3fd..f02b2f1 100644 --- a/tests/roots/test-dummy/index.rst +++ b/tests/roots/test-dummy/index.rst @@ -2,6 +2,8 @@ :pdg-listing:`pi-plus-minus; 2018` +:pdg-review:`Quark Model; 2015; p.2` + :pdg-review:`Kinematics` :pdg-review:`QCD; p5` diff --git a/tests/test_role.py b/tests/test_role.py index 3630f22..24b601b 100644 --- a/tests/test_role.py +++ b/tests/test_role.py @@ -13,6 +13,7 @@ def test_text(app, warning) -> None: assert lines[::2] == [ f"PDG{DEFAULT_YEAR}", "PDG2018", + "PDG2015, §Quark Model, p.2", f"PDG{DEFAULT_YEAR}, §Kinematics", f"PDG{DEFAULT_YEAR}, §QCD, p.5", "PDG2014, §Resonances", @@ -30,6 +31,7 @@ def test_html(app, warning) -> None: assert [ref.text for ref in external_refs] == [ f"PDG{DEFAULT_YEAR}", "PDG2018", + "PDG2015, §Quark Model, p.2", "PDG2020, §Kinematics", "PDG2020, §QCD, p.5", "PDG2014, §Resonances", @@ -38,6 +40,7 @@ def test_html(app, warning) -> None: assert [ref.get("href") for ref in external_refs] == [ "https://pdg.lbl.gov/2020/listings/rpp2020-list-K-zero.pdf", "https://pdg.lbl.gov/2018/listings/rpp2018-list-pi-plus-minus.pdf", + "https://pdg.lbl.gov/2015/reviews/rpp2015-rev-quark-model.pdf#page=2", "https://pdg.lbl.gov/2020/reviews/rpp2020-rev-kinematics.pdf", "https://pdg.lbl.gov/2020/reviews/rpp2020-rev-qcd.pdf#page=5", "https://pdg.lbl.gov/2014/reviews/rpp2014-rev-resonances.pdf",