Skip to content

FIX: Preserve user classes containing -start on gated directives - #93

Open
akashchamp wants to merge 1 commit into
executablebooks:mainfrom
akashchamp:fix-gated-start-classes
Open

akashchamp wants to merge 1 commit into
executablebooks:mainfrom
akashchamp:fix-gated-start-classes

Conversation

@akashchamp

Copy link
Copy Markdown

Fixes #90.

The gated merge transforms rewrote every class on the node: MergeGatedExercises did cls.replace("-start", "") and MergeGatedSolutions did attr.replace("solution-start", "solution"), so a user :class: quick-start came out as quick (and my-solution-start-thing as my-solution-thing). Now only the exact exercise-start / solution-start marker class is mapped; everything else passes through unchanged.

Added a small gatedclasses test root and test_gated_user_classes_preserved, which builds a gated exercise and a gated solution with -start-containing classes and checks the emitted class attributes. It fails on main (exercise quick admonition, solution my-solution-thing admonition) and passes with the fix (exercise quick-start admonition, solution my-solution-start-thing admonition).

Full suite passes locally (117 passed, Python 3.12, Sphinx 8.2.3) and pre-commit is clean on the changed files.

MergeGatedExercises stripped "-start" from every class on the node and
MergeGatedSolutions replaced "solution-start" anywhere in each class, so
user classes such as quick-start were silently renamed. Map only the
exact exercise-start / solution-start marker classes.

Fixes executablebooks#90
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.

Gated merge silently mangles user :class: values containing '-start'

1 participant