]> gitweb.factorcode.org Git - factor.git/blob - extra/help/help-docs.factor
Initial import
[factor.git] / extra / help / help-docs.factor
1 USING: help.markup help.crossref help.topics help.syntax
2 definitions io prettyprint inspector ;
3 IN: help
4
5 ARTICLE: "printing-elements" "Printing markup elements"
6 "When writing documentation, it is useful to be able to print markup elements for testing purposes. Markup elements which are strings or arrays of elements are printed in the obvious way. Markup elements of the form " { $snippet "{ $directive content... }" } " are printed by executing the " { $snippet "$directive" } " word with the element content on the stack."
7 { $subsection print-element }
8 { $subsection print-content } ;
9
10 ARTICLE: "span-elements" "Span elements"
11 { $subsection $emphasis }
12 { $subsection $strong }
13 { $subsection $link }
14 { $subsection $vocab-link }
15 { $subsection $snippet }
16 { $subsection $url } ;
17
18 ARTICLE: "block-elements" "Block elements"
19 "Paragraph break:"
20 { $subsection $nl }
21 "Standard headings for word documentation:"
22 { $subsection $values }
23 { $subsection $description }
24 { $subsection $class-description }
25 { $subsection $error-description }
26 { $subsection $var-description }
27 { $subsection $contract }
28 { $subsection $examples }
29 { $subsection $warning }
30 { $subsection $notes }
31 { $subsection $side-effects }
32 { $subsection $errors }
33 { $subsection $see-also }
34 "Boilerplate paragraphs:"
35 { $subsection $low-level-note }
36 { $subsection $io-error }
37 "Some additional elements:"
38 { $subsection $code }
39 { $subsection $curious }
40 { $subsection $example }
41 { $subsection $heading }
42 { $subsection $links }
43 { $subsection $list }
44 { $subsection $markup-example }
45 { $subsection $references }
46 { $subsection $see }
47 { $subsection $subsection }
48 { $subsection $table } ;
49
50 ARTICLE: "markup-utils" "Markup element utilities"
51 "Utility words to assist in defining new elements:"
52 { $subsection simple-element }
53 { $subsection ($span) }
54 { $subsection ($block) } ;
55
56 ARTICLE: "element-types" "Element types"
57 "Markup elements can be classified into two broad categories, block elements and span elements. Block elements are inset with newlines before and after, whereas span elements flow with the paragraph text."
58 { $subsection "span-elements" }
59 { $subsection "block-elements" }
60 { $subsection "markup-utils" } ;
61
62 ARTICLE: "browsing-help" "Browsing documentation"
63 "The easiest way to browse the help is from the help browser tool in the UI, however you can also display help topics in the listener. Help topics are identified by article name strings, or words. You can request a specific help topic:"
64 { $subsection help }
65 "You can also display the main help article for a vocabulary:"
66 { $subsection about } ;
67
68 ARTICLE: "writing-help" "Writing documentation"
69 "By convention, documentation is written in files whose names end with " { $snippet "-docs.factor" } ". Vocabulary documentation should be placed in the same directory as the vocabulary source code; see " { $link "vocabs.loader" } "."
70 $nl
71 "A pair of parsing words are used to define free-standing articles and to associate documentation with words:"
72 { $subsection POSTPONE: ARTICLE: }
73 { $subsection POSTPONE: HELP: }
74 "A parsing word defines the main help article for a vocabulary:"
75 { $subsection POSTPONE: ABOUT: }
76 "The " { $emphasis "content" } " in both cases is a " { $emphasis "markup element" } ", a recursive structure taking one of the following forms:"
77 { $list
78     { "a string," }
79     { "an array of markup elements," }
80     { "or an array of the form " { $snippet "{ $directive content... }" } ", where " { $snippet "$directive" } " is a markup word whose name starts with " { $snippet "$" } ", and " { $snippet "content..." } " is a series of markup elements" }
81 }
82 { $subsection "element-types" }
83 "Related words can be cross-referenced:"
84 { $subsection related-words } ;
85
86 ARTICLE: "help-impl" "Help system implementation"
87 "Help topic protocol:"
88 { $subsection article-name }
89 { $subsection article-title }
90 { $subsection article-content }
91 { $subsection article-parent }
92 { $subsection set-article-parent }
93 "Boilerplate word help can be automatically generated (for example, slot accessor help):"
94 { $subsection word-help }
95 { $subsection word-help* }
96 "Help article implementation:"
97 { $subsection article }
98 { $subsection articles }
99 "Links:"
100 { $subsection link }
101 { $subsection >link }
102 "Utilities for traversing markup element trees:"
103 { $subsection elements }
104 { $subsection collect-elements }
105 "Links and " { $link article } " instances implement the definition protocol; refer to " { $link "definitions" } "." ;
106
107 ARTICLE: "help" "Help system"
108 "The help system maintains documentation written in a simple markup language, along with cross-referencing and search. Documentation can either exist as free-standing " { $emphasis "articles" } " or be associated with words."
109 { $subsection "browsing-help" }
110 { $subsection "writing-help" }
111 { $subsection "help-impl" } ;
112
113 ABOUT: "help"
114
115 HELP: $title
116 { $values { "topic" "a help article name or a word" } }
117 { $description "Prints a help article's title, or a word's " { $link summary } ", depending on the type of " { $snippet "topic" } "." } ;
118
119 HELP: help
120 { $values { "topic" "an article name or a word" } }
121 { $description
122     "Displays a help article or documentation associated to a word on the " { $link stdio } " stream."
123 } ;
124
125 HELP: about
126 { $values { "vocab" "a vocabulary specifier" } }
127 { $description
128     "Displays the main help article for the vocabulary. The main help article is set with the " { $link POSTPONE: ABOUT: } " parsing word."
129 } ;
130
131 HELP: :help
132 { $description "Displays documentation for the most recent error." } ;
133
134 HELP: $subsection
135 { $values { "element" "a markup element of the form " { $snippet "{ topic }" } } }
136 { $description "Prints a large clickable link to the help topic named by the first string element of " { $snippet "element" } "." }
137 { $examples
138     { $code "{ $subsection \"sequences\" }" }
139 } ;
140
141 HELP: $index
142 { $values { "element" "a markup element containing one quotation with stack effect " { $snippet "( quot -- )" } } }
143 { $description "Calls the quotation to generate a sequence of help topics, and outputs a " { $link $subsection } " for each one." } ;
144
145 HELP: ($index)
146 { $values { "seq" "a sequence of help article names and words" } { "quot" "a quotation with stack effect " { $snippet "( topic -- )" } } }
147 { $description "Writes a list of " { $link $subsection } " elements to the " { $link stdio } " stream." } ;
148
149 HELP: xref-help
150 { $description "Update help cross-referencing. Usually this is done automatically." } ;
151
152 HELP: sort-articles
153 { $values { "seq" "a sequence of help topics" } { "newseq" "a sequence of help topics" } }
154 { $description "Sorts a sequence of help topics." } ;
155
156 { article-children article-parent xref-help } related-words