Skip to content

Commit

Permalink
Replace relative markdown links with full path (#34)
Browse files Browse the repository at this point in the history
* Replace relative markdown links with full path. This will allow order file to exist in another folder than markdown file.
* Updates from prettier after format of README.
  • Loading branch information
reijoh authored Feb 13, 2024
1 parent 697126d commit d76635a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ on:
types: [opened, synchronize]
branches: [main]
paths:
- 'docs/design/*.md'
- 'docs/design/*.order'
- "docs/design/*.md"
- "docs/design/*.order"

jobs:
pdf:
Expand Down
17 changes: 11 additions & 6 deletions tools/convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ get_file_path() {
if [ -z "${1}" ]; then
echo ''
elif [ -e ${1} ]; then
echo $(realpath "${1}")
echo $(readlink -f "${1}")
elif [ -e ${2}/${1} ]; then
echo $(realpath ${2}/${1})
echo $(readlink -f ${2}/${1})
else
echo ''
fi
Expand Down Expand Up @@ -212,7 +212,7 @@ fi
if ! [ -d "${DocsPath}" ]; then
error '' "Unable to find folder ${DocsPath}" 1
fi
scriptPath=$(dirname -- $(realpath "$0"))
scriptPath=$(dirname -- $(readlink -f "$0"))
# Get path to docs files in the same folder as the docs
historyFilePath=$(get_file_path "$HistoryFile" $DocsPath)
orderFilePath=$(get_file_path "$OrderFile" $DocsPath)
Expand All @@ -238,10 +238,15 @@ versionHistory=$(get_version_history)
info 'Merge markdown files'
files=$(
cat -- ${orderFilePath} | while read line; do
if ! [ -f "${DocsPath}/${line}" ]; then
error '' "Unable to find markdown file ${DocsPath}/${line}" 1
if test -n "${line}"; then
if ! [ -f "${DocsPath}/${line}" ]; then
error '' "Unable to find markdown file ${DocsPath}/${line}" 1
fi
mdfile=$(readlink -f -- "${DocsPath}/${line}")
mdpath=$(dirname -- $mdfile)
sed -i -e "s|\(\[.*\](\)\(.*)\)|\1${mdpath}/\2|g" $mdfile
echo "${mdfile}"
fi
echo "${DocsPath}/${line}"
done
)
markdownContent=$(awk 'FNR==1 && NR > 1{print ""}1' $files)
Expand Down

0 comments on commit d76635a

Please sign in to comment.