wikipedia: strftime + tests

char-rename
Björn Lindqvist 2017-01-03 15:37:53 +01:00
parent e10754a298
commit b9030b953e
2 changed files with 13 additions and 5 deletions

View File

@ -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

View File

@ -1,10 +1,10 @@
! Copyright (C) 2012 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: accessors ascii assocs calendar colors.constants
formatting html.entities html.parser html.parser.analyzer
html.parser.printer http.client io io.styles kernel namespaces
sequences splitting urls wrap.strings xml xml.data xml.traversal ;
USING: accessors ascii assocs colors.constants formatting
html.entities html.parser html.parser.analyzer html.parser.printer
http.client io io.styles kernel namespaces sequences splitting urls
wrap.strings xml xml.data xml.traversal ;
FROM: xml.data => tag? ;
IN: wikipedia
@ -44,7 +44,7 @@ SYMBOL: language
children-tags [ item. ] each nl ;
: historical-url ( timestamp -- url )
[ month-name ] [ day>> ] bi "%s_%s" sprintf wikipedia-url ;
"%B_%d" strftime wikipedia-url ;
: (historical-events) ( timestamp -- seq )
historical-url http-get nip string>xml "ul" deep-tags-named ;