Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/syui/hugo-theme-wave.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bin/lunr.sh')
-rwxr-xr-xbin/lunr.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/lunr.sh b/bin/lunr.sh
new file mode 100755
index 0000000..612161c
--- /dev/null
+++ b/bin/lunr.sh
@@ -0,0 +1,24 @@
+#!/bin/zsh
+d=${0:a:h:h}
+# backup
+h=${0:a:h}
+if cat $j|jq . ;then
+ cp $j $h
+fi
+h=$h/PagesIndex.json
+j=$d/static/bower_components/lunr.js/PagesIndex.json
+t=`cat $j |jq '.[]'|sed -e 's#/post##g'`
+a=`cat $j | sed -e 's#/post##g'`
+echo $a >! $j
+t=`echo $t|jq -r '.href'|cut -d - -f 1-4`
+
+for (( i=1;i<=`echo "$t"|wc -l`;i++ ))
+do
+ f=`echo "$t"|awk "NR==$i"`
+ c=`echo $f|tr '-' '/'`
+ sed -i "" "s#${f}#${c}#g" $j
+done
+
+cat $j
+
+diff $j $h