]> gitweb.factorcode.org Git - factor.git/blob - basis/interpolate/interpolate-docs.factor
interpolate: split out format into a hook
[factor.git] / basis / interpolate / interpolate-docs.factor
1 USING: help.markup help.syntax io math strings ;
2 IN: interpolate
3
4 HELP: interpolate
5 { $values { "str" string } }
6 { $description "String interpolation using named variables and/or stack arguments, writing to the " { $link output-stream } "." }
7 { $notes "Stack arguments are numbered from the top of the stack, or provided anonymously by order of arguments." }
8 { $examples
9     { $example
10         "USING: interpolate ;"
11         "\"Bob\" \"Alice\" \"Hi ${1}, it's ${0}.\" interpolate"
12         "Hi Bob, it's Alice."
13     }
14     { $example
15         "USING: interpolate namespaces ;"
16         "\"Fred\" \"name\" [ \"Hi ${name}\" interpolate ] with-variable"
17         "Hi Fred"
18     }
19     { $example
20         "USING: interpolate ;"
21         "\"Mr.\" \"Anderson\"" "\"Hello, ${} ${}\" interpolate"
22         "Hello, Mr. Anderson"
23     }
24 } ;
25
26 HELP: interpolate>string
27 { $values { "str" string } { "newstr" string } }
28 { $description "String interpolation using named variables and/or stack arguments, captured as a " { $link string } "." }
29 { $notes "Stack arguments are numbered from the top of the stack, or provided anonymously by order of arguments." } ;
30
31 { interpolate interpolate>string } related-words