Uh oh!
There was an error while loading. Please reload this page.
Markdown updates for 3.1.1 - #3991
Merged
Merged
Conversation
lornajane
commented
Aug 1, 2024
ContributorAuthor
Script to update anchors and rewrite all our links: fromsysimportargvfrompathlibimportPathimportre# this script tries to inflect the old links, some are just missing and we need to use the title's version insteadupdates= {}
updates["revision-history"] ="appendix-a-revision-history"updates["data-type-conversion"] ="appendix-b-data-type-conversion"updates["using-r-f-c6570-implementations"] ="appendix-c-using-rfc6570-implementations"updates["serializing-headers-and-cookies"] ="appendix-d-serializing-headers-and-cookies"updates["percent-encoding-and-form-media-types"] ="appendix-e-percent-encoding-and-form-media-types"updates["document-structure"] ="openapi-description-structure"updates["oas-object"] ="openapi-object"updates["components-security-schemes"] ="security-scheme-object"updates["schema-composition"] ="composition-and-inheritance-polymorphism"updates["http-codes"] ="http-status-codes"updates["oas-document"] ="openapi-description"updates["rich-text"] ="rich-text-formatting"updates["relative-references"] ="relative-references-in-urls"updates["relative-references"] ="relative-references-in-urls"updates["runtime-expression"] ="runtime-expressions"updates["runtime-expression-examples"] ="examples"updates["relative-references"] ="relative-references-in-urls"updates["relative-references-u-r-i"] ="relative-references-in-api-description-uris"updates["relative-references-u-r-l"] ="relative-references-in-api-urls"updates["binary-data"] ="working-with-binary-data"updates["base-vocabulary"] ="oas-base-vocabulary"defkebab_it(c):
ifc.lower() !=c: returnf'-{c.lower()}'returncif__name__=='__main__':
text=Path(argv[1]).read_text()
names= {}
removals= {}
formatchinre.finditer(r'\n(.*)<a name="([^"]*)"', text):
name=match.group(2)
names[name] =''.join([kebab_it(c) forcinname])
# was it a heading? file it for removaliflen(match.group(1)) andmatch.group(1)[0] =="#":
removals[name] =Trueforcurrent, replacementinnames.items():
ifreplacementinupdates:
replacement=updates[replacement]
text=text.replace(f'(#{current})', f'(#{replacement})')
# only remove if removal is indicated, otherwise updateifcurrentinremovals:
text=text.replace(f'<a name="{current}"></a>', '')
else:
text=text.replace(f'<a name="{current}"></a>', f'<a name="{replacement}"></a>')
print(text) |
lornajane
commented
Aug 1, 2024
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lornajane
marked this pull request as ready for review
August 5, 2024 09:11
ralfhandl
approved these changes
Aug 5, 2024
jeremyfiel
approved these changes
Aug 5, 2024
This was referenced Aug 15, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replay of the steps from #3932 to update the markdown formatting and links for 3.1.1
(mysterious python script needed a few additions, included in a comment)