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