X-Git-Url: https://iankelling.org/git/?p=mediawiki-setup;a=blobdiff_plain;f=get-wiki-snapshot;h=07e5a5e225dc06a9e13c042aaad8fa2724438815;hp=578732ba0c1f185fdafd716014c75dde94617e68;hb=HEAD;hpb=6bc8621a503a1372f2c534f2b99485e9d0ec9329 diff --git a/get-wiki-snapshot b/get-wiki-snapshot index 578732b..07e5a5e 100755 --- a/get-wiki-snapshot +++ b/get-wiki-snapshot @@ -4,7 +4,10 @@ set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR -cd "${BASH_SOURCE%/*}" +# usage: get-wiki-snapshot [-l] +# -l means generate script from local guide, don't download new one. + +x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*} script_file=mw-setup-script @@ -13,7 +16,7 @@ start=' * *' end=' *<\/source> *' if [[ $1 != -l ]]; then # use local file - ruby <<'EOF' > $page_file + ruby <<'EOF' > $page_file require 'json' puts JSON.parse(`curl -k 'https://ofswiki.org/w/api.php?\ action=query&titles=Mediawiki_Setup_Guide&prop=revisions&rvprop=content&\ @@ -25,6 +28,7 @@ fi #!/bin/bash # Copyright (C) 2016 Ian Kelling # This program is under GPL v. 3 or later, see +set -x EOF sed -rn "/^$start$/,/^$end$/{s/^($start|$end)$/# \0/;p}" $page_file } > $script_file