Skip to content

docs: flip TOML and envvars order #2389

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

henryiii
Copy link
Contributor

To start, I've asked Copilot for a script to flip the order of the tabs. It gave me this one:

import re

# filepath: /Users/henryschreiner/git/software/cibuildwheel/docs/options.md
file_path = "/Users/henryschreiner/git/software/cibuildwheel/docs/options.md"

# Regular expression to match the examples section
example_pattern = re.compile(
    r"(!!! tab examples \"Environment variables\".*?```.*?```.*?)"
    r"(!!! tab examples \"pyproject\.toml\".*?```.*?```.*?)",
    re.DOTALL
)

def flip_examples(file_path):
    with open(file_path, "r") as file:
        content = file.read()

    # Swap the order of the examples
    updated_content = example_pattern.sub(r"\2\n\n\1", content)

    with open(file_path, "w") as file:
        file.write(updated_content)

    print("Examples flipped successfully!")

# Run the function
flip_examples(file_path)

This commit is the result of that.


Next I'd like to update the headings so that both options are shown. I'd like to put one on the left, the other on the right, but not sure how to do that yet. Putting this here for now.

Signed-off-by: Henry Schreiner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant