You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2017/06/19 12:31:07 UTC

[23/50] [abbrv] sling-site git commit: Script to fix front matter

Script to fix front matter


Project: http://git-wip-us.apache.org/repos/asf/sling-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/sling-site/commit/5168c614
Tree: http://git-wip-us.apache.org/repos/asf/sling-site/tree/5168c614
Diff: http://git-wip-us.apache.org/repos/asf/sling-site/diff/5168c614

Branch: refs/heads/master
Commit: 5168c614d915b07c6375e4896f958462fd620e83
Parents: 7c29eda
Author: Bertrand Delacretaz <bd...@apache.org>
Authored: Wed Jun 14 12:07:53 2017 -0400
Committer: Bertrand Delacretaz <bd...@apache.org>
Committed: Wed Jun 14 12:07:53 2017 -0400

----------------------------------------------------------------------
 conversion-scripts/fix-front-matter.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sling-site/blob/5168c614/conversion-scripts/fix-front-matter.sh
----------------------------------------------------------------------
diff --git a/conversion-scripts/fix-front-matter.sh b/conversion-scripts/fix-front-matter.sh
new file mode 100755
index 0000000..65e8bef
--- /dev/null
+++ b/conversion-scripts/fix-front-matter.sh
@@ -0,0 +1,27 @@
+MARKER="~~~~~~"
+COPYING=0
+TMPFILE=/tmp/$$.tmp
+cat > $TMPFILE
+TITLE=$(cat $TMPFILE | grep ^Title: | cut -d: -f2- | sed 's/^ *//g')
+
+doFrontMatter() {
+cat << EOFM
+title=$TITLE		
+type=page
+status=published
+${MARKER}
+EOFM
+}
+
+cat $TMPFILE | while read line
+do
+	if [[ $COPYING -eq 1 ]]
+	then
+		echo "$line"
+	elif [[ "$line" == "$MARKER" ]]
+	then
+		COPYING=1
+		doFrontMatter
+	fi
+done | grep -v ^Title:
+rm -f $TMPFILE
\ No newline at end of file