wikipedia: strftime + tests
parent
e10754a298
commit
b9030b953e
|
@ -0,0 +1,8 @@
|
||||||
|
USING: calendar tools.test urls wikipedia.private ;
|
||||||
|
IN: wikipedia.tests
|
||||||
|
|
||||||
|
{
|
||||||
|
URL" http://en.wikipedia.org/wiki/October_10"
|
||||||
|
} [
|
||||||
|
2010 10 10 <date> historical-url
|
||||||
|
] unit-test
|
|
@ -1,10 +1,10 @@
|
||||||
! Copyright (C) 2012 John Benediktsson
|
! Copyright (C) 2012 John Benediktsson
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
! See http://factorcode.org/license.txt for BSD license
|
||||||
|
|
||||||
USING: accessors ascii assocs calendar colors.constants
|
USING: accessors ascii assocs colors.constants formatting
|
||||||
formatting html.entities html.parser html.parser.analyzer
|
html.entities html.parser html.parser.analyzer html.parser.printer
|
||||||
html.parser.printer http.client io io.styles kernel namespaces
|
http.client io io.styles kernel namespaces sequences splitting urls
|
||||||
sequences splitting urls wrap.strings xml xml.data xml.traversal ;
|
wrap.strings xml xml.data xml.traversal ;
|
||||||
FROM: xml.data => tag? ;
|
FROM: xml.data => tag? ;
|
||||||
|
|
||||||
IN: wikipedia
|
IN: wikipedia
|
||||||
|
@ -44,7 +44,7 @@ SYMBOL: language
|
||||||
children-tags [ item. ] each nl ;
|
children-tags [ item. ] each nl ;
|
||||||
|
|
||||||
: historical-url ( timestamp -- url )
|
: historical-url ( timestamp -- url )
|
||||||
[ month-name ] [ day>> ] bi "%s_%s" sprintf wikipedia-url ;
|
"%B_%d" strftime wikipedia-url ;
|
||||||
|
|
||||||
: (historical-events) ( timestamp -- seq )
|
: (historical-events) ( timestamp -- seq )
|
||||||
historical-url http-get nip string>xml "ul" deep-tags-named ;
|
historical-url http-get nip string>xml "ul" deep-tags-named ;
|
||||||
|
|
Loading…
Reference in New Issue