]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix help.html for Dan's recent changes
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 1 Feb 2009 02:44:30 +0000 (20:44 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 1 Feb 2009 02:44:30 +0000 (20:44 -0600)
basis/help/html/html-tests.factor
basis/help/html/html.factor

index 475b2114b3cb6dda21f61383e973b328e927f4d1..61414cdfa2f1dddf9388601a44a18dc7b4bb4222 100644 (file)
@@ -1,5 +1,4 @@
 IN: help.html.tests
-USING: html.streams classes.predicate help.topics help.markup
-io.streams.string accessors prettyprint kernel tools.test ;
+USING: help.html tools.test help.topics kernel ;
 
-[ ] [ [ [ \ predicate-instance? def>> . ] with-html-writer ] with-string-writer drop ] unit-test
+[ ] [ "xml" >link help>html drop ] unit-test
index 820261dd32ad2c67016ef37235370dc1a2233101..26fc4e263711c07598921d42a3fba52ebcf3a424 100644 (file)
@@ -1,11 +1,11 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: io.encodings.utf8 io.encodings.ascii io.encodings.binary
 io.files io.files.temp io.directories html.streams help kernel
 assocs sequences make words accessors arrays help.topics vocabs
 tools.vocabs tools.vocabs.browser namespaces prettyprint io
 vocabs.loader serialize fry memoize unicode.case math.order
-sorting debugger html.elements html ;
+sorting debugger html xml.literals xml.writer ;
 IN: help.html
 
 : escape-char ( ch -- )
@@ -51,17 +51,21 @@ M: f topic>filename* drop \ f topic>filename* ;
         ] "" make
     ] [ 2drop f ] if ;
 
-M: topic browser-link-href topic>filename ;
+M: topic url-of topic>filename ;
 
-: help-stylesheet ( -- )
-    "resource:basis/help/html/stylesheet.css" ascii file-contents write ;
+: help-stylesheet ( -- string )
+    "resource:basis/help/html/stylesheet.css" ascii file-contents
+    [XML <style><-></style> XML] ;
 
-: help>html ( topic -- )
-    dup topic>filename utf8 [
-        dup article-title
-        [ <style> help-stylesheet </style> ]
-        [ [ help ] with-html-writer ] simple-page
-    ] with-file-writer ;
+: help>html ( topic -- xml )
+    [ article-title ]
+    [ drop help-stylesheet ]
+    [ [ help ] with-html-writer ]
+    tri simple-page ;
+          
+: generate-help-file ( topic -- )
+    dup .
+    dup topic>filename utf8 [ help>html write-xml ] with-file-writer ;
 
 : all-vocabs-really ( -- seq )
     #! Hack.
@@ -87,7 +91,7 @@ M: topic browser-link-href topic>filename ;
     all-vocabs-really [ dup vocab-name ] { } map>assoc "vocabs.idx" serialize-index ;
 
 : generate-help-files ( -- )
-    all-topics [ '[ _ help>html ] try ] each ;
+    all-topics [ '[ _ generate-help-file ] try ] each ;
 
 : generate-help ( -- )
     "docs" temp-file