]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix HTML doc generation bugs
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 30 Sep 2008 00:43:59 +0000 (19:43 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 30 Sep 2008 00:43:59 +0000 (19:43 -0500)
basis/help/html/html.factor
basis/html/streams/streams.factor

index 525db1352fc11cb3bc37956cfd35f008c216c9d4..386dca9576bcd9a463c4d9ffb54435fc4fafa9cf 100644 (file)
@@ -29,21 +29,28 @@ IN: help.html
 
 GENERIC: topic>filename* ( topic -- name prefix )
 
-M: word topic>filename* [ name>> ] [ vocabulary>> ] bi 2array "word" ;
-M: link topic>filename* name>> "article" ;
+M: word topic>filename*
+    dup vocabulary>> [
+        [ name>> ] [ vocabulary>> ] bi 2array "word"
+    ] [ drop f f ] if ;
+
+M: link topic>filename* name>> dup [ "article" ] [ topic>filename* ] if ;
 M: word-link topic>filename* name>> topic>filename* ;
 M: vocab-spec topic>filename* vocab-name "vocab" ;
 M: vocab-tag topic>filename* name>> "tag" ;
 M: vocab-author topic>filename* name>> "author" ;
+M: f topic>filename* drop \ f topic>filename* ;
 
 : topic>filename ( topic -- filename )
-    [
-        topic>filename* % "-" %
-        dup array?
-        [ [ escape-filename ] map "," join ]
-        [ escape-filename ]
-        if % ".html" %
-    ] "" make ;
+    topic>filename* dup [
+        [
+            % "-" %
+            dup array?
+            [ [ escape-filename ] map "," join ]
+            [ escape-filename ]
+            if % ".html" %
+        ] "" make
+    ] [ 2drop f ] if ;
 
 M: topic browser-link-href topic>filename ;
 
index 6874dc2eddfb1eb159dd30c1a9b2cc4b89eb498e..fa81a69bb403bfb4fc44cdcd9e8ad2b8b22041fe 100755 (executable)
@@ -4,7 +4,7 @@ USING: combinators generic assocs help http io io.styles
 io.files continuations io.streams.string kernel math math.order
 math.parser namespaces make quotations assocs sequences strings
 words html.elements xml.entities sbufs continuations destructors
-accessors arrays ;
+accessors arrays urls.encoding ;
 IN: html.streams
 
 GENERIC: browser-link-href ( presented -- href )
@@ -44,12 +44,14 @@ TUPLE: html-sub-stream < html-stream style parent ;
 : object-link-tag ( style quot -- )
     presented pick at [
         browser-link-href [
-            <a =href a> call </a>
+            <a url-encode =href a> call </a>
         ] [ call ] if*
     ] [ call ] if* ; inline
 
 : href-link-tag ( style quot -- )
-    href pick at [ <a =href a> call </a> ] [ call ] if* ; inline
+    href pick at [
+        <a url-encode =href a> call </a>
+    ] [ call ] if* ; inline
 
 : hex-color, ( color -- )
     [ red>> ] [ green>> ] [ blue>> ] tri