Skip to content

Commit 41da97f

Browse files
committed
fix: set section toc level
1 parent d1c281b commit 41da97f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tools/git_script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ find "$KB" -maxdepth 1 -type f ! -name "p8_*" -exec rm -v {} \;
5656

5757
cd "$GIT_REPO_LOCAL"
5858
"$SCRIPT_DIR/generate_toc.sh" ./ "$PYDIO_V8_RELATIVE_URL"
59-
"$SCRIPT_DIR/section_toc_index.sh" ./ 3
59+
"$SCRIPT_DIR/section_toc_index.sh" . 2
6060

6161
git add .
6262
git commit -m "Add pydio-v8 documentation"
@@ -175,7 +175,7 @@ git checkout cells-flows
175175

176176
cd "$GIT_REPO_LOCAL"
177177
"$SCRIPT_DIR/generate_toc.sh" ./ "$CELLS_V4_RELATIVE_URL"
178-
"$SCRIPT_DIR/section_toc_index.sh" ./ 3
178+
"$SCRIPT_DIR/section_toc_index.sh" . 2
179179

180180
git add .
181181
git commit -m "Add cells-v4 documentation"

tools/section_toc_index.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extract_title_from_nav() {
2222
local dir="$1"
2323
local nav_file="$dir/.nav.yaml"
2424
if [[ -f "$nav_file" ]]; then
25-
grep -m1 '^title:' "$nav_file" | cut -d':' -f2- | sed 's/^ *//' | sed 's/"//g'
25+
grep -m1 '^title:' "$nav_file" | cut -d':' -f2- | sed 's/^ *//' | sed 's/"//g' |sed "s/^['\"]//; s/['\"]$//"
2626
fi
2727
}
2828

@@ -33,7 +33,7 @@ extract_slug_from_md() {
3333

3434
extract_title_from_md() {
3535
local file="$1"
36-
grep -m1 '^title:' "$file" | cut -d':' -f2- | sed 's/^ *//' | sed 's/"//g'
36+
grep -m1 '^title:' "$file" | cut -d':' -f2- | sed 's/^ *//' | sed 's/"//g' | sed "s/^['\"]//; s/['\"]$//"
3737
}
3838

3939
build_slug_path() {
@@ -71,7 +71,7 @@ generate_toc() {
7171
parent_slug_path=$(build_slug_path "$(dirname "$item")")
7272
relative_slug_path="${parent_slug_path#*/}"
7373
link="../${relative_slug_path}/${slug}"
74-
toc+="$(printf "\n%s* [%s](%s)\n" "$indent" "$title" "$link")"
74+
toc+="$(printf "\n%s- [%s](%s)\n" "$indent" "$title" "$link")"
7575

7676
elif [[ -d "$item" ]]; then
7777
title=$(extract_title_from_nav "$item")
@@ -81,7 +81,7 @@ generate_toc() {
8181
parent_slug_path=$(build_slug_path "$item")
8282
relative_folder_path="${parent_slug_path#*/}"
8383
folder_link="../${relative_folder_path}/index/"
84-
toc+="$(printf "\n%s* **[%s](%s)**\n" "$indent" "$title" "$folder_link")"
84+
toc+="$(printf "\n%s- [%s](%s)\n" "$indent" "$title" "$folder_link")"
8585
toc+=$(generate_toc "$base_dir" "$(realpath --relative-to="$base_dir" "$item")" $((depth + 1)) "$indent ")
8686
fi
8787
done

0 commit comments

Comments
 (0)