X-Git-Url: https://iankelling.org/git/?p=mediawiki-setup;a=blobdiff_plain;f=get-wiki-snapshot;h=b89bafa7f122a5e5ab8c7a6618e251d58869a2f5;hp=578732ba0c1f185fdafd716014c75dde94617e68;hb=26831bf52ab8a90dc2a3556ec91aa010dd93c530;hpb=e8ca8d27f45d2585bb8fba1d9d60a1f56fb170d6 diff --git a/get-wiki-snapshot b/get-wiki-snapshot index 578732b..b89bafa 100755 --- a/get-wiki-snapshot +++ b/get-wiki-snapshot @@ -4,6 +4,9 @@ set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR +# usage: get-wiki-snapshot [-l] +# -l means generate script from local guide, don't download new one. + cd "${BASH_SOURCE%/*}" @@ -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