Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Internal Links To Boards In The Support Matrix #3256

Merged
merged 2 commits into from Aug 10, 2020

Conversation

sommersoft
Copy link
Collaborator

@sommersoft sommersoft commented Aug 8, 2020

Implements #2923. Allows the following: https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html#<id>

@askpatrickw was correct, rST's csv-table parsing just wouldn't allow the reference to be generated. I switched it to use a list-table, using an example in the docutils reference of applying internal hyperlink targets.

The only tricky part is utilizing the resulting hyperlink target. docutils normalizes the identifiers to conform to this regex: [a-z](-?[a-z0-9]+)*. This may prove difficult to replicate in certain instances. Programmatically, something like re.sub(r"\W+", "-") should suffice for the special characters; the rest is just lowercase and stripping non-alpha leading characters. Manually, its just a matter of looking at the HTML source on RTD I guess.

Here is an example of the resulting HTML (truncated elements, for easier reading):

<tbody id="commander">
    <tr class="row-even">
        <td><p>8086 Commander</p></td>
    </tr>
    <tr class="row-odd" id="adafruit-circuit-playground-bluefruit">
        <td><p>Adafruit Circuit Playground Bluefruit</p></td>
    </tr>
    <tr class="row-odd" id="j-j-studios-datum-light">
        <td><p>J&amp;J Studios datum-Light</p></td>
    </tr>
    <tr class="row-even" id="ndgarage-n-bit6-feathersnow-v2">
        <td><p>ndGarage[n°] Bit6: FeatherSnow-v2</p></td>
    </tr>
</tbody>

…ould cause a no-id situation when names like 'ndGarage[n°] Bit6: FeatherSnow-v2' were parsed.
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you!

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.

None yet

2 participants