www/tools/convert_page.sh

18 lines
446 B
Bash
Raw Permalink Normal View History

2023-06-13 12:47:07 +02:00
#!/bin/sh
2018-05-20 22:54:37 +02:00
if [ $# -lt 2 ]; then
echo "Usage: $0 Mediawiki_Page_Name [page|post]"
exit
fi
echo Converting $1...
2023-06-13 12:47:07 +02:00
page=$(echo $1 | sed 's,/,_,g' | tr '[:upper:]' '[:lower:]')
2018-05-20 22:54:37 +02:00
hugo new $2/$page.md
2023-06-13 12:47:07 +02:00
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 \
2023-06-14 12:24:12 +02:00
>> content/$2/$page.md