espressif / esp-docs

Python based wrapper for Sphinx, intended to simplify and extend Sphinx's functionality to better suit the documentation needs for Espressif's development frameworks
22 stars 14 forks source link

fix: local substring substitution regex match #10

Closed Harshal5 closed 11 months ago

Harshal5 commented 11 months ago

The regex used for matching the patterns for local substring substitution does not match the specified target in some parts of the ESP-IDF docs build. Actual text rendering on the docs site is still using the "default" field from the custom macros, rather than using target-specific ones.

For example in the secure boot documentation, the substitution for IDF_TARGET_SBV2_KEY renders the "default" field even if the target (esp32c6 or esp32h2 or esp32p4) is specified.

For the current regex to correctly substitute the target, either, we can change the string in docs to:

{IDF_TARGET_SBV2_KEY:default="RSA-3072", esp32c2="ECDSA-256 or ECDSA-192", esp32c6="RSA-3072, ECDSA-256, or ECDSA-192", esp32h2="RSA-3072, ECDSA-256, or ECDSA-192", esp32p4="RSA-3072, ECDSA-256, or ECDSA-192"}

that is, re-write all the key algorithms for all the targets, or just update the regex in the esp-docs.

IMO rewriting would just keep bulking up the string for more future targets whereas if we update the regex itself then we would just need to add a small entry (or {target_name}) for every new target as done here.

Harshal5 commented 11 months ago

Moving the PR to internal GitLab process