Skip to content

Commit

Permalink
update links in script for compatibility with theme #137 #139
Browse files Browse the repository at this point in the history
  • Loading branch information
TomKellyGenetics committed Nov 23, 2020
1 parent 304a4b8 commit ece16fb
Showing 1 changed file with 36 additions and 18 deletions.
54 changes: 36 additions & 18 deletions wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -628,28 +628,46 @@ if [[ $render == true ]]; then
git submodule update -f --recursive
fi

#update links
sed -i "s/root: \.$/root: ../\npermalink: \/LICENSE\//g" LICENSE.md
#sed -i "s/root: \.$/root: . \# Is the only page that doesn't follow the pattern \/:path\/index.html\npermalink: index.html/g" index.md

### corrections for new lessons

#+root: . # Is the only page that doesn't follow the pattern /:path/index.html
#+permalink: index.html

#+root: ..
#+permalink: /LICENSE/

#+Title: "Reference"
#+root: ..
#+permalink: /reference/
#rename code of conduct if needed
if [ -f CODE_OF_CONDUCT.md ]; then
mv CODE_OF_CONDUCT.md CONDUCT.md
fi

#+title: "Setup"
#+root: ..
#+permalink: /setup/
#update links
# add title if missing
sed -i "3s/root: \./Title: "Licenses"\nroot: \./g" LICENSE.md
sed -i "3s/root: \./Title: "Contributor Code of Conduct"\nroot: \./g" CONDUCT.md
sed -i "3s/root: \./Title: "Reference"\nroot: \./g" reference.md
sed -i "3s/root: \./Title: "Setup"\nroot: \./g" setup.md

# add root if missing
sed -i "3s/---/root: \/\n---/g" index.md
sed -i "3s/root: \./root: \//g" index.md
sed -i "4s/---/root: \.\n---/g" LICENSE.md CONDUCT.md
sed -i "4s/---/root: \.\.\n---/g" reference.md setup.md
sed -i "3s/---/root: \.\n---/g" LICENSE.md CONDUCT.md
sed -i "3s/---/root: \.\.\n---/g" reference.md setup.md
sed -i "3s/---/root: \.\n---/g" aio.md

# add permlink if missing
sed -i "s/root\: \/\$/root\: \/\npermalink\: index.html/g" index.md
sed -i "s/root\: \.\$/root\: \.\npermalink\: \/LICENSE\//g" LICENSE.md
sed -i "s/root\: \.\$/root\: \.\npermalink\: \/conduct\//g" CONDUCT.md
sed -i "s/root\: \.\.\$/root\: ..\npermalink\: \/reference\//g" reference.md
sed -i "s/root\: \.\.\$/root\: ..\npermalink\: \/setup\//g" setup.md
sed -i "s/root\: \.\.\$/root\: ..\npermalink\: \/aio\//g" aio.md

# remove if appears twice
sed -i '5{/permalink: index\.html/d;}' index.md
sed -i '6{/permalink\: \/LICENSE\//d;}' LICENSE.md
sed -i '6{/permalink\: \/conduct\//d;}' CONDUCT.md
sed -i '6{/permalink\: \/reference\//d;}' reference.md
sed -i '6{/permalink\: \/setup\//d;}' setup.md
sed -i '5{/permalink\: \/aio\//d;}' aio.md

#add changes
git add -u
git add index.md CONDUCT.md LICENSE.md reference.md setup.md aio.md

git submodule update -f --recursive
git submodule add https://github.com/${remote_user}/${repo}.git ./_locale/${locale}
Expand Down

0 comments on commit ece16fb

Please sign in to comment.