File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,17 +43,25 @@ TITLE=${TITLE:-"Presentation Title"}
4343echo
4444echo " 📝 Updating files..."
4545
46+ # Function to replace text in files (cross-platform)
47+ replace_in_file () {
48+ local file=$1
49+ local pattern=$2
50+ local replacement=$3
51+ sed " s|$pattern |$replacement |g" " $file " > " $file .tmp" && mv " $file .tmp" " $file "
52+ }
53+
4654# Update README.md
47- sed -i " s| YOUR-USERNAME| $OWNER |g " README.md
48- sed -i " s| YOUR-REPO-NAME| $REPO |g " README.md
49- sed -i " s| Presentation Title| $TITLE |g " README.md
55+ replace_in_file README.md " YOUR-USERNAME" " $OWNER "
56+ replace_in_file README.md " YOUR-REPO-NAME" " $REPO "
57+ replace_in_file README.md " Presentation Title" " $TITLE "
5058
5159# Update index.html
52- sed -i " s| Presentation Title| $TITLE |g " index.html
53- sed -i " s| slides/presentation.md| slides/$REPO .md|g " index.html
60+ replace_in_file index.html " Presentation Title" " $TITLE "
61+ replace_in_file index.html " slides/presentation.md" " slides/$REPO .md"
5462
5563# Update package.json
56- sed -i " s| \" name\" : \" presentation-template\" | \" name\" : \" $REPO \" |g " package.json
64+ replace_in_file package.json " \" name\" : \" presentation-template\" " " \" name\" : \" $REPO \" "
5765
5866# Rename the markdown file
5967if [ -f " slides/presentation.md" ]; then
You can’t perform that action at this time.
0 commit comments