wiki-word-regexp re-matches ;
: wiki-word-links ( str -- str )
- wiki-word-regexp "$1" "$1" link-tag re-replace ;
+ wiki-word-regexp "$1" "$1" re-replace ;
: get-wiki-page ( name -- text )
"wiki" get [ get ] bind ;
: wiki-footer ( name -- )
"<hr>" print
- "Edit" swap "edit?" swap cat2 link-tag write ;
+ "Edit" swap "edit?" swap cat2 write ;
: serve-existing-page ( name text -- )
over [ write-wiki-page wiki-footer ] html-document ;
--- /dev/null
+ΓΏ
\ No newline at end of file
USE: stack
USE: streams
USE: test
+USE: stdio
+USE: math
[ 4 ] [ "/library/test/io/no-trailing-eol.factor" run-resource ] unit-test
: lines-test ( stream -- line1 line2 )
- dup freadln swap dup freadln swap fclose ;
+ [ read read ] with-stream ;
[
"This is a line."
[
"This is a line.\rThis is another line.\r"
] [
- 500 "/library/test/io/mac-os-eol.txt" <resource-stream> fread#
+ "/library/test/io/mac-os-eol.txt" <resource-stream>
+ [ 500 read# ] with-stream
+] unit-test
+
+[
+ 255
+] [
+ "/library/test/io/binary.txt" <resource-stream>
+ [ read1 ] with-stream >fixnum
] unit-test