Skip to content

Conversation

@pzich
Copy link
Contributor

@pzich pzich commented Sep 19, 2025

Description:

The current apiref shortcode is based on string manipulation, essentially:

  • get value after / (file name without path)
  • replace all _ with __
  • replace all . with _8
  • replace all : with _1
  • replace all capital letters with _<lowercase>

This works for most filenames, but if some files have the same name in different directories, that is included as well (see thread).

Since there isn't a way to generate these URLs consistently, this function uses the tagfile generated by GENERATE_TAGFILE (esphome/esphome#10794), converts that into an easily consumable map of file/struct/etc. name -> Doxygen URL

This also includes mappings for the above values excluding esphome::, esphome/, esphome/core/ and esphome/components/ so the shorter names can be used (e.g. sensor::Sensor instead of esphome::sensor::Sensor, or select/select.h instead of components/select/select.h or esphome/components/select/select.h).

Related issue (if applicable): fixes #5215

Pull request in esphome with YAML changes (if applicable):

Checklist:

  • I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • I am merging into current because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.

  • Link added in /components/index.rst when creating new documents for new components or cookbook.

esphome[bot]
esphome bot previously requested changes Sep 19, 2025
Copy link

@esphome esphome bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a feature matched with a PR in https://github.com/esphome/esphome, please target your PR to the next branch and rebase.

@esphome
Copy link

esphome bot commented Sep 19, 2025

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@esphome esphome bot marked this pull request as draft September 19, 2025 09:52
Comment on lines +38 to +40
curl -s -S https://api-docs.esphome.io/tags.xml | script/format_api_tags.py > data/apirefs/current.json
curl -s -S https://api-docs-beta.esphome.io/tags.xml | script/format_api_tags.py > data/apirefs/beta.json
curl -s -S https://api-docs-dev.esphome.io/tags.xml | script/format_api_tags.py > data/apirefs/next.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This won't work until esphome/esphome#10794 lands and is deployed everywhere, so for now I have been applying that locally, running doxygen, and changing this to something like:

Suggested change
curl -s -S https://api-docs.esphome.io/tags.xml | script/format_api_tags.py > data/apirefs/current.json
curl -s -S https://api-docs-beta.esphome.io/tags.xml | script/format_api_tags.py > data/apirefs/beta.json
curl -s -S https://api-docs-dev.esphome.io/tags.xml | script/format_api_tags.py > data/apirefs/next.json
cat /path/to/esphome/esphome/api-docs/tags.xml | script/format_api_tags.py > data/apirefs/current.json
cp data/apirefs/current.json data/apirefs/beta.json
cp data/apirefs/current.json data/apirefs/next.json

@pzich pzich mentioned this pull request Sep 19, 2025
3 tasks
@pzich pzich changed the base branch from current to next September 19, 2025 22:48
esphome[bot]
esphome bot previously requested changes Sep 19, 2025
Copy link

@esphome esphome bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a feature matched with a PR in https://github.com/esphome/esphome, please target your PR to the next branch and rebase.

@pzich pzich changed the base branch from next to current September 19, 2025 22:48
@esphome esphome bot added the next label Sep 19, 2025
@esphome esphome bot dismissed their stale review September 19, 2025 22:49

Base branch has been corrected - dismissing previous review.

esphome[bot]
esphome bot previously requested changes Sep 19, 2025
Copy link

@esphome esphome bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a feature matched with a PR in https://github.com/esphome/esphome, please target your PR to the next branch and rebase.

@pzich pzich changed the base branch from current to next September 19, 2025 22:50
esphome[bot]
esphome bot previously requested changes Sep 19, 2025
Copy link

@esphome esphome bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a feature matched with a PR in https://github.com/esphome/esphome, please target your PR to the next branch and rebase.

@esphome esphome bot added the next label Sep 19, 2025
@esphome esphome bot dismissed their stale review September 19, 2025 22:50

Base branch has been corrected - dismissing previous review.

@pzich
Copy link
Contributor Author

pzich commented Sep 19, 2025

It seems like any mention of esphome/esphome PRs makes the bot insist this should only go into next, but it should probably go into current too depending on the timing.

@pzich pzich marked this pull request as ready for review September 19, 2025 22:51
@esphome esphome bot dismissed stale reviews from themself September 19, 2025 22:51

Stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[switch] Link to API reference is broken

1 participant