Create a directory for the page

This commit is contained in:
Vladimir Panteleev 2013-08-29 21:58:12 +00:00
parent da45348751
commit f56f4dd789
1 changed files with 6 additions and 1 deletions

View File

@ -39,6 +39,11 @@ int main(string[] args)
enforce(args.length==2, "No article specified"); enforce(args.length==2, "No article specified");
auto name = args[1]; auto name = args[1];
auto fn = sanitizeFn(name);
if (!exists(fn))
mkdir(fn);
chdir(fn);
if (!exists("history.xml")) if (!exists("history.xml"))
enforce(spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://" ~ language ~ ".wikipedia.org/w/index.php?title=Special:Export&pages=" ~ encodeComponent(name), "-o", "history.xml"])==0, "curl error"); enforce(spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://" ~ language ~ ".wikipedia.org/w/index.php?title=Special:Export&pages=" ~ encodeComponent(name), "-o", "history.xml"])==0, "curl error");
@ -66,7 +71,7 @@ int main(string[] args)
"committer " ~ committer ~ " <" ~ committer ~ "@" ~ language ~ ".wikipedia.org> " ~ ISO8601toRFC2822(child["timestamp"].text) ~ "\n" ~ "committer " ~ committer ~ " <" ~ committer ~ "@" ~ language ~ ".wikipedia.org> " ~ ISO8601toRFC2822(child["timestamp"].text) ~ "\n" ~
"data " ~ to!string(summary.length) ~ "\n" ~ "data " ~ to!string(summary.length) ~ "\n" ~
summary ~ "\n" ~ summary ~ "\n" ~
"M 644 inline " ~ sanitizeFn(name) ~ ".txt\n" ~ "M 644 inline " ~ fn ~ ".txt\n" ~
"data " ~ to!string(text.length) ~ "\n" ~ "data " ~ to!string(text.length) ~ "\n" ~
text ~ "\n" ~ text ~ "\n" ~
"\n"; "\n";