From ae53ae6b3e6aec0f6bae272873cc1033e8e61484 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Sun, 20 May 2018 22:54:37 +0200 Subject: [PATCH] Add conversion tool --- tools/convert_page | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 tools/convert_page diff --git a/tools/convert_page b/tools/convert_page new file mode 100755 index 0000000..5c9916e --- /dev/null +++ b/tools/convert_page @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ $# -lt 2 ]; then + echo "Usage: $0 Mediawiki_Page_Name [page|post]" + exit +fi + +echo Converting $1... + +page=$(echo $1 | sed 's,/,_,g'|tr '[:upper:]' '[:lower:]') + +hugo new $2/$page.md +curl -s https://berlin.ccc.de/api.php\?action\=query\&prop\=revisions\&rvprop\=content\&format\=json\&titles\=$1 | \ + jq -r '.query.pages |..| objects|.["*"]'| sed '/null/d' | pandoc -f mediawiki -t markdown \ + >> content/$2/$page.md