-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btrfs-progs: ci: build html manual page previews if source changed
Similar to the manual page on terminal preview, also do the html output that will be on the RTD page. Due to the way how it's displayed in the CI action summary the CSS is missing and there are some visual artifacts, e.g. in the option lists or special characters. Issue: #824 Signed-off-by: David Sterba <[email protected]>
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
# Generate manual page preview as rendered by 'make html', removed some styling | ||
# so there can be visual artifacts, usable for CI summary | ||
|
||
if ! [ -f "$1" ]; then | ||
exit 0 | ||
fi | ||
|
||
prefix=Documentation/ | ||
here=$(pwd) | ||
|
||
if [ "$(basename \"$here\")" = 'Documentation' ]; then | ||
prefix= | ||
fi | ||
|
||
fn="$1" | ||
bn=$(basename "$fn" .rst) | ||
html=$(find "${prefix}"_build/html -name "$bn".'html') | ||
|
||
if ! [ -f "$html" ]; then | ||
#echo "ERROR: cannot find html page '$html' from bn $bn fn $fn <br/>" | ||
exit 0 | ||
fi | ||
|
||
cat << EOF | ||
<details> | ||
<summary>$fn</summary> | ||
EOF | ||
|
||
# Up to <div itemprop="articleBody">, before that there's left bar navigation | ||
|
||
cat "$html" | sed -e 's/^\s\+//' | awk ' | ||
/^<div itemprop=.articleBody.>/ { doit=1; next; } | ||
/^<\/body>/ { doit=0; next; } | ||
doit==1 { print; }' | ||
|
||
cat << EOF | ||
</details> | ||
EOF |