Created
March 15, 2024 19:35
-
-
Save pedro-psb/f5ad6bd85b18ee98b76fb797ce649d9c to your computer and use it in GitHub Desktop.
This script creates a CHANGES.md file converted from an rst file and perform characteristic cleanups.
This file contains 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
#/bin/bash | |
# https://gist.github.com/zaiste/77a946bbba73f5c4d33f3106a494e6cd | |
FILENAME="CHANGES" | |
pandoc "$FILENAME.rst" -f rst -t markdown -o "$FILENAME.md" | |
# quotes: \"hupper\" -> "hupper" | |
sed -i "$FILENAME.md" -e 's/\\\("[a-zA-Z_-]*\)\\"/\1"/g' | |
# github: `4976`{.interpreted-text role="github"} -> [4976](https://github.../issues/4976) | |
sed -i "$FILENAME.md" -e 's/`\([0-9]*\)`{.interpreted-text role="github"}/[\1](https:\/\/github.com\/pulp\/REPONAMEHERE\/issues\/\1)/g' | |
sed -i "$FILENAME.md" -e 's/REPONAMEHERE/pulpcore/g' | |
# headeres: ## 3.46.0 (2024-02-13) -> ## 3.46.0 (2024-02-13) {: #0.23.2 } | |
sed -i "$FILENAME.md" -e 's/## \([0-9]\+\.[0-9]\+\.[0-9]\+\) ([0-9-]\+)/\0 {: #\1 }/' | |
# backticks: [python_package]{.title-ref} -> `python_package` | |
sed -i "$FILENAME.md" -e 's/\[\([a-zA-Z0-9_-]*\)\]{.title-ref}/`\1`/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment