~zenomat/tinywiki

728e6a1a1fadaf1d71d88be4b7aecffa9dcabf69 — Adrian 2 months ago db287be master
Change grep regex to not replace inter-document links
1 files changed, 1 insertions(+), 1 deletions(-)

M build.sh
M build.sh => build.sh +1 -1
@@ 62,7 62,7 @@ find . -name "*.md" ! -name "index-ins.md" | while read -r file; do
	cp $workdir/$file $outdir/tmp
	awk -v S="$(cat $outdir/tmp/index-ins.md)" '/\[\[index\]\]/{$0=S}1' "$file" > "$outdir/tmp/$name.md"

	grep -Po '\[.+\]\((?!https?:\/\/).*(?<!\.html|\.png|\.svg|\.jpg)\)' "$workdir/$file" | while read match; do
	grep -Po '\[.+\]\((?!#.*)(?!https?:\/\/).*(?<!\.html|\.png|\.svg|\.jpg)\)' "$workdir/$file" | while read match; do
		clean_match=$(echo $match | awk -F '(' ' {{print $2}} ' | cut -f 1 -d ')')
		link=$clean_match.html
		escaped_match=$(printf '%s\n' "$clean_match" | sed -e 's/[\/&]/\\&/g')