executablebooks / sphinx-external-toc

A sphinx extension that allows the site-map to be defined in a single YAML file
https://sphinx-external-toc.readthedocs.io
MIT License
34 stars 18 forks source link

Include Titles in FileItems #88

Open bame-da opened 1 year ago

bame-da commented 1 year ago

This fixes an issue where sphinx-autoupdate does not pick up changes to titles in the _toc.yaml file.

To reproduce, use the example project,

  1. build using sphinx-autobuild --port 8001 . _build/
  2. add a title attributes to one of the files, eg api.md
  3. change the title int he title attribute

You'll see that the change does not get picked up. The reason is that line 251 of api.py does an equality check on the items in the sitemap: prev_doc = previous[name]. Since the title is included in the Document class, the changes in 2. and 3. above trigger a rebuild of the api.md. But the ToC is injected into the intro.md file, which is unchanged both as a file and from the point of view of the get_changed function.

By including the titles on FileItems, such changes get picked up by get_changed and the ToC updates correctly.

welcome[bot] commented 1 year ago

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.
Welcome to the EBP community! :tada:

codecov[bot] commented 1 year ago

Codecov Report

Base: 91.06% // Head: 91.14% // Increases project coverage by +0.07% :tada:

Coverage data is based on head (176d6d4) compared to base (4e83bb6). Patch coverage: 92.30% of modified lines in pull request are covered.

:exclamation: Current head 176d6d4 differs from pull request most recent head 8a33082. Consider uploading reports for the commit 8a33082 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #88 +/- ## ========================================== + Coverage 91.06% 91.14% +0.07% ========================================== Files 7 7 Lines 739 745 +6 ========================================== + Hits 673 679 +6 Misses 66 66 ``` | Flag | Coverage Δ | | |---|---|---| | pytests | `91.14% <92.30%> (+0.07%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/executablebooks/sphinx-external-toc/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks) | Coverage Δ | | |---|---|---| | [sphinx\_external\_toc/parsing.py](https://codecov.io/gh/executablebooks/sphinx-external-toc/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-c3BoaW54X2V4dGVybmFsX3RvYy9wYXJzaW5nLnB5) | `92.17% <75.00%> (+0.04%)` | :arrow_up: | | [sphinx\_external\_toc/api.py](https://codecov.io/gh/executablebooks/sphinx-external-toc/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-c3BoaW54X2V4dGVybmFsX3RvYy9hcGkucHk=) | `94.33% <100.00%> (+0.28%)` | :arrow_up: | | [sphinx\_external\_toc/events.py](https://codecov.io/gh/executablebooks/sphinx-external-toc/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-c3BoaW54X2V4dGVybmFsX3RvYy9ldmVudHMucHk=) | `90.41% <100.00%> (-0.06%)` | :arrow_down: | | [sphinx\_external\_toc/tools.py](https://codecov.io/gh/executablebooks/sphinx-external-toc/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-c3BoaW54X2V4dGVybmFsX3RvYy90b29scy5weQ==) | `90.24% <100.00%> (+0.05%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.