Skip to content

Commit e4052be

Browse files
committed
gendocs.sh: generate links to source files on GitHub
Signed-off-by: Jonathan Dowland <jdowland@redhat.com>
1 parent c0ca858 commit e4052be

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

tools/gendocs.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ cat <<EOF
2121
</header>
2222
EOF
2323

24-
behave --dry-run --format=steps.catalog --no-summary |
25-
sed -E 's!^((Given|When|Then).*)$!## \1\n!' | # turn steps into Mdwn headers
26-
sed -E 's#Location: (.*:.*)#[\1](\1)\n#' | # mdwn-link to implementation
27-
sed -E 's#^ ##' | # stop preformatted descriptions
28-
python3 -m markdown
24+
fork="cekit" # TODO: permit override from environment
25+
branch="v1"
26+
linkroot="https://github.com/${fork}/behave-test-steps/blob/${branch}/"
27+
28+
behave --dry-run --format=steps.catalog --no-summary |
29+
sed -E 's!^((Given|When|Then).*)$!## \1\n!' | # turn steps into Mdwn headers
30+
sed -E "s#Location: (.*):(.*)#[\1:\2](${linkroot}\1\#L\2)\n#" | # mdwn-link to the implementation
31+
sed -E 's#^ ##' | # stop preformatted descriptions # convert to HTML
32+
python3 -m markdown # convert to HTML
2933

3034
cat <<EOF
3135

0 commit comments

Comments
 (0)