Skip to content
Browse files

[scripts] allow setting suffix from type name

e.g. en:dict -> enwiktionary

Signed-off-by: Christopher Hall <hsw@openmoko.com>
  • Loading branch information...
1 parent 00b7f83 commit 53c5ce5cc99f89cfa1738a131319c33fb5813d46 @hxw hxw committed
Showing with 8 additions and 2 deletions.
  1. +8 −2 scripts/DownloadWikiXML
View
10 scripts/DownloadWikiXML
@@ -11,7 +11,7 @@ ERROR()
USAGE()
{
[ -z "$1" ] || echo error: "$*"
- echo usage: $(basename "$0") '<options> [<language-code>...]'
+ echo usage: $(basename "$0") '<options> [<language-code>{:<type>}...]'
echo ' --help -h this message'
echo ' --verbose -v more messages'
echo ' --url=<url> -u <url> base URL for downloads ['${RootURL}']'
@@ -22,6 +22,8 @@ USAGE()
exit 1
}
+# ListOfAllContentTypes, TypeToName, TypeToFilename
+. "$(dirname "$0")/wiki-names.sh"
# main program
@@ -101,9 +103,13 @@ then
fi
+# process each lang{:type} argument
for arg in $*
do
- url=${RootURL}/${arg}${suffix}
+ lang=${arg%:*}
+ typename=$(TypeToName "${arg#*:}")
+ [ -z "${typename}" ] && typename="${suffix}"
+ url="${RootURL}/${lang}${typename}"
stamp=$(lynx -dump "${url}" | awk '
BEGIN {

0 comments on commit 53c5ce5

Please sign in to comment.
Something went wrong with that request. Please try again.