diff --git a/wp2git.d b/wp2git.d index 458c44b..c749283 100644 --- a/wp2git.d +++ b/wp2git.d @@ -11,10 +11,10 @@ import litexml; int main(string[] args) { - string name; + string name, language="en"; bool usage, noImport; - foreach (arg; args[1..$]) - switch (arg) + for (int i=1; i=2 && name[0]=='"' && name[$-1]=='"') name = name[1..$-1]; // strip quotes - if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://en.wikipedia.org/w/index.php?title=Special:Export&pages=" ~ encodeComponent(name), "-o", "history.xml"])) + if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://" ~ language ~ ".wikipedia.org/w/index.php?title=Special:Export&pages=" ~ encodeComponent(name), "-o", "history.xml"])) throw new Exception("curl error"); fwritefln(stderr, "Loading history..."); @@ -67,10 +73,10 @@ int main(string[] args) string text = child["text"].text; fwritefln(stderr, "Revision %s by %s: %s", id, committer, summary); - summary ~= "\n\nhttp://en.wikipedia.org/w/index.php?oldid=" ~ id; + summary ~= "\n\nhttp://" ~ language ~ ".wikipedia.org/w/index.php?oldid=" ~ id; data ~= "commit refs/heads/master\n" ~ - "committer " ~ committer ~ " <" ~ committer ~ "@en.wikipedia.org> " ~ ISO8601toRFC2822(child["timestamp"].text) ~ "\n" ~ + "committer " ~ committer ~ " <" ~ committer ~ "@" ~ language ~ ".wikipedia.org> " ~ ISO8601toRFC2822(child["timestamp"].text) ~ "\n" ~ "data " ~ .toString(summary.length) ~ "\n" ~ summary ~ "\n" ~ "M 644 inline " ~ name ~ ".txt\n" ~