Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -4,28 +4,28 @@
|
|||
-export( [init_http/0, per_language/1, rosetta_code_list_of/1] ).
|
||||
|
||||
init_http() ->
|
||||
application:start( inets ).
|
||||
application:start( inets ).
|
||||
|
||||
per_language( Language ) ->
|
||||
ok = init_http(),
|
||||
Tasks = rosetta_code_list_of( "Programming_Tasks" ),
|
||||
Uninplemented = Tasks -- rosetta_code_list_of( Language ),
|
||||
io:fwrite( "Unimplemented total: ~p~n", [erlang:length(Uninplemented)] ),
|
||||
[io:fwrite("~p~n", [X]) || X <- Uninplemented].
|
||||
ok = init_http(),
|
||||
Tasks = rosetta_code_list_of( "Programming_Tasks" ),
|
||||
Uninplemented = Tasks -- rosetta_code_list_of( Language ),
|
||||
io:fwrite( "Unimplemented total: ~p~n", [erlang:length(Uninplemented)] ),
|
||||
[io:fwrite("~p~n", [X]) || X <- Uninplemented].
|
||||
|
||||
rosetta_code_list_of( Category ) ->
|
||||
URL = "http://rosettacode.org/mw/api.php?action=query&list=categorymembers&cmlimit=500&format=xml&cmtitle=Category:"
|
||||
++ Category,
|
||||
title_contents( URL, "", [] ).
|
||||
URL = "http://rosettacode.org/mw/api.php?action=query&list=categorymembers&cmlimit=500&format=xml&cmtitle=Category:"
|
||||
++ Category,
|
||||
title_contents( URL, "", [] ).
|
||||
|
||||
|
||||
|
||||
title_contents( URL, Continue, Acc ) ->
|
||||
{ok, {{_HTTP,200,"OK"}, _Headers, Body}} = httpc:request( URL ++ Continue ),
|
||||
{XML, _} = xmerl_scan:string( Body ),
|
||||
News = xml_selection( "title", XML ),
|
||||
New_continue = title_contents_url_continue( xml_selection("cmcontinue", XML) ),
|
||||
title_contents_continue( URL, New_continue, Acc ++ News ).
|
||||
{ok, {{_HTTP,200,"OK"}, _Headers, Body}} = httpc:request( URL ++ Continue ),
|
||||
{XML, _} = xmerl_scan:string( Body ),
|
||||
News = xml_selection( "title", XML ),
|
||||
New_continue = title_contents_url_continue( xml_selection("cmcontinue", XML) ),
|
||||
title_contents_continue( URL, New_continue, Acc ++ News ).
|
||||
|
||||
title_contents_continue( _URL, "", Acc ) -> Acc;
|
||||
title_contents_continue( URL, Continue, Acc ) -> title_contents( URL, Continue, Acc ).
|
||||
|
|
@ -34,7 +34,7 @@ title_contents_url_continue( [] ) -> "";
|
|||
title_contents_url_continue( [Continue | _] ) -> "&cmcontinue=" ++ Continue.
|
||||
|
||||
xml_selection( Selection, XML ) ->
|
||||
[lists:map( fun xml_8211/1, X) || #xmlAttribute{value=X} <- xmerl_xpath:string("//@" ++ Selection, XML)].
|
||||
[lists:map( fun xml_8211/1, X) || #xmlAttribute{value=X} <- xmerl_xpath:string("//@" ++ Selection, XML)].
|
||||
|
||||
xml_8211( 8211 ) -> $-;
|
||||
xml_8211( 924 ) -> $\s;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue