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 ;
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 )
: 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