From c1d99ff8216acaee9a885ecba3028daf18f9f231 Mon Sep 17 00:00:00 2001 From: Castro0o Date: Mon, 25 Nov 2019 15:13:06 +0100 Subject: [PATCH] all material needed --- .gitignore | 2 ++ LFP.sh | 14 ++++++++++++++ README.md | 12 ++++++++++++ wiki2html_icml.sh | 19 +++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 .gitignore create mode 100755 LFP.sh create mode 100644 README.md create mode 100755 wiki2html_icml.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6c08ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.icml +*.html diff --git a/LFP.sh b/LFP.sh new file mode 100755 index 0000000..564f3e9 --- /dev/null +++ b/LFP.sh @@ -0,0 +1,14 @@ +#!/bin/sh + + +api_querypage="https://pzwiki.wdka.nl/mw-mediadesign/api.php?format=json&action=query&list=categorymembers&cmtitle=Category:LFP_Publication" +for page in `curl -s $api_querypage | jq .query[][].title | sed 's/\ /\_/g' | sed 's/\"//g'` +do echo $page +./wiki2html_icml.sh $page +done + +# curl -s "https://pzwiki.wdka.nl/mw-mediadesign/api.php?format=json&action=query&list=categorymembers&cmtitle=Category:LFP_Publication" | jq .query[][].title + +# api_querypage="https://pzwiki.wdka.nl/mw-mediadesign/api.php?format=json&action=query&titles="$pagetitle"&prop=revisions&rvprop=content" +# echo $api_querypage $file_wiki +# curl -s $api_querypage | jq '.query.pages[].revisions[]."*"' > $file_wiki diff --git a/README.md b/README.md new file mode 100644 index 0000000..b334a48 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ + +Script creates HTML and ICML files from Mediadesign wiki pages under the category `[[Category:LFP Publication]]` + +# Requirements + +* pandoc `brew install pandoc` `sudo apt install pandoc` +* jq `brew install jq` `sudo apt install jq` +* `brew install curl` `sudo apt install curl` + +# Run + +`./LFP.sh` diff --git a/wiki2html_icml.sh b/wiki2html_icml.sh new file mode 100755 index 0000000..6216b4a --- /dev/null +++ b/wiki2html_icml.sh @@ -0,0 +1,19 @@ +#!/bin/sh +if [ -n "$1" ]; then + pagetitle=$1 +else + echo "Wikipage title not supplied as script argument" + exit +fi + +file_wiki=$pagetitle".wiki" +file_icml=$pagetitle".icml" +file_html=$pagetitle".html" +api_querypage="https://pzwiki.wdka.nl/mw-mediadesign/api.php?format=json&action=query&titles="$pagetitle"&prop=revisions&rvprop=content" +echo $api_querypage $file_wiki +curl -s $api_querypage | jq '.query.pages[].revisions[]."*"' > $file_wiki + + +pandoc $file_wiki -f mediawiki -t html -o $file_html +pandoc $file_wiki -f mediawiki -t icml -s -o $file_icml +rm $file_wiki