help.html: change back to the old naming scheme because we have too many links to existing doc articles all over the net

db4
Slava Pestov 2011-12-04 13:46:13 -08:00
parent e75a4c13b4
commit 72fdb8c5fb
1 changed files with 33 additions and 10 deletions

View File

@ -1,16 +1,38 @@
! Copyright (C) 2008, 2011 Slava Pestov. ! Copyright (C) 2008, 2011 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: checksums checksums.sha io.encodings.utf8 USING: io.encodings.utf8 io.encodings.binary io.files
io.encodings.binary io.encodings.string io.files io.files.temp io.files.temp io.directories html.streams help help.home kernel
io.directories html.streams help help.home kernel assocs assocs sequences make words accessors arrays help.topics vocabs
sequences make words accessors arrays help.topics vocabs vocabs.hierarchy help.vocabs namespaces prettyprint io
vocabs.hierarchy help.vocabs namespaces io vocabs.loader vocabs.loader serialize fry memoize unicode.case math.order
serialize fry memoize unicode.case math.order sorting debugger sorting debugger html xml.syntax xml.writer math.parser
html xml.syntax xml.writer math.parser sets hashtables ; sets hashtables ;
FROM: io.encodings.ascii => ascii ; FROM: io.encodings.ascii => ascii ;
FROM: ascii => ascii? ; FROM: ascii => ascii? ;
IN: help.html IN: help.html
: escape-char ( ch -- )
dup ascii? [
dup H{
{ CHAR: " "__quo__" }
{ CHAR: * "__star__" }
{ CHAR: : "__colon__" }
{ CHAR: < "__lt__" }
{ CHAR: > "__gt__" }
{ CHAR: ? "__que__" }
{ CHAR: \\ "__back__" }
{ CHAR: | "__pipe__" }
{ CHAR: / "__slash__" }
{ CHAR: , "__comma__" }
{ CHAR: @ "__at__" }
{ CHAR: # "__hash__" }
{ CHAR: % "__percent__" }
} at [ % ] [ , ] ?if
] [ number>string "__" "__" surround % ] if ;
: escape-filename ( string -- filename )
[ [ escape-char ] each ] "" make ;
GENERIC: topic>filename* ( topic -- name prefix ) GENERIC: topic>filename* ( topic -- name prefix )
M: word topic>filename* M: word topic>filename*
@ -29,9 +51,10 @@ M: f topic>filename* drop \ f topic>filename* ;
topic>filename* dup [ topic>filename* dup [
[ [
% "-" % % "-" %
dup array? [ "," join ] when dup array?
utf8 encode sha1 checksum-bytes hex-string [ [ escape-filename ] map "," join ]
% ".html" % [ escape-filename ]
if % ".html" %
] "" make ] "" make
] [ 2drop f ] if ; ] [ 2drop f ] if ;