Skip to content

Commit 1467f6b

Browse files
committed
fix: Harden page title generation in FTM
1 parent b7cc4bd commit 1467f6b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

script/autoHeader.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ find $DOC_DIR -name "*.md" | while read pathfile; do
3030

3131
# If a title was find, add it in the header
3232
if [ ! -z "$title" ];then
33-
# Remove the "#" from the title
34-
title=$(echo "$title" | sed 's/\#//g')
33+
# Remove the "#" from the title and extra spaces around it
34+
title=$(echo "$title" | sed -r 's/\ ?+\#\ +//g' )
3535

3636
# Remove the title from the file content
3737
sed -i '/^\#\ /d' "$pathfile"
@@ -41,7 +41,7 @@ find $DOC_DIR -name "*.md" | while read pathfile; do
4141
sed -i '1s/^/---\n\n/' "$pathfile";
4242

4343
# Writing title
44-
sed -i "1s/^/title: $title\n/" "$pathfile";
44+
sed -i "1s/^/title: \"$title\"\n/" "$pathfile";
4545

4646
# The id is (by default) egal to the filename
4747
# -> We want it

0 commit comments

Comments
 (0)