root / trunk / docscripts / README.txt

Revision 5544, 9.7 kB (checked in by pottedmeat, 2 years ago)

Deferred works with local search

  • Property svn:eol-style set to native
Line 
1How the dojo-driven Doc Tool Will Work
2======================================
3
4The various pieces
5------------------
6
7* docparser.php runs through all of the files and searches for patterns. It can do all basic functionality.
8* inc/helpers.inc writeToDisc creates a bunch of JSON files (stored in the json directory)
9* dojo.doc has four important functions:
10** functionNames loads the list function names from the function_names object
11** getMeta grabs the meta information for a function from a JSON object
12** getSrc grabs the source from a stored file
13** getDoc goes out to http://manual.dojotoolkit.org and grabs external documentation
14* dojo.widget.ComboBox provides a search interface to dojo.docs. Right now, we're just replacing a function on initialization. It might be worth extending ComboBox later, though it seems like overkill. Maybe move this to DocPane.
15* dojo.widget.DocPane gives a front end to displaying search results, package, and function information
16
17There will be a bunch of topic events that get thrown around. This is basically how they will interact:
18
19* dojo.docs.functionNames gets called and its values are set with ComboBox.dataProvider.setData() to create the ComboBox drop down
20* When the search is executed, it sends a topic event ("/docs/search") with the current text
21* dojo.docs._onDocSearch responds to that event by returning a topic event ("/docs/function/results" or "/docs/package/results")
22* dojo.widget.DocPane
23* If there is only one result, it throws back a topic event ("/docs/function/select") with that one result
24* If there is more than one result, it displays the search results. Clicking on a search result throws the topic event ("/docs/function/select") with the row's result
25* dojo.docs._onDocSelectFunction catches and responds to that event by throwing a topic event ("/docs/function/detail")
26* dojo.widget.DocPane responds to that event by displaying the method details
27* If a package is found, it throws back ("/docs/package/detail")
28* dojo.widget.DocPane catches it and displays the package details.
29
30The topic registry
31------------------
32
33*publisher*: the expected widgets or code that are typically expected to publish data on that topic.
34(of course anyone is free to publish on any topic at any time)
35*subscriber*: types of widgets or code that are expected to subscribe to this topic
36*message*: the format of that particular topics message:
37*returns*: what the object returns
38
39"/docs/search":
40        publisher: any widget or code that wishes to search for documents
41        subscriber: dojo.docs
42        messsage: {
43                selectKey: id of the docSearch request,
44                name: string containing function to search for
45        }
46
47"/docs/function/select":
48        publisher: any widget that can select a function
49        subscriber: dojo.docs and any other widget that wishes to be aware of a selection
50        message: {
51                selectKey: identifier (optional),
52                pkg: The package the method is in (optional)
53                name: string with name of the function,
54                id: the polymorphic id of the function (maybe be blank, or undefined if the default)
55        }
56       
57"/docs/package/select":
58        publisher: any widget that can select a function
59        subscriber: dojo.docs and any other widget that wishes to be aware of a selection
60        message: {
61                selectKey: identifier (optional),
62                pkg: The package to select (use either this or name)
63                name: The package to select (use either this or pkg)
64        }
65
66"/docs/function/results":
67        publisher: dojo.docs
68        subscriber: any widget or code that wishes to see the results of current doc searches
69        message: [{
70                        package: string with the package (require statement) containing the function
71                        name: string with name of function,
72                        id: the polymorphic id of the function (may be blank if the default),
73                        summary: string containing one line summary of the function,
74        }]
75
76"/docs/function/detail":
77        publisher: dojo.docs
78        subscriber: Any widget that wishes to be aware of a selection's details
79        message: {
80                        selectKey: identifier
81                        pkg: The package of the function
82                        name: The function name
83                        id: If this has a polymorphic ID, here it is
84                        meta: object of the metadata (as shown in the meta JSON object),
85                        doc: docs (TBD: Things like parameter descriptions, extended description, return description)
86                        sig: Function signature
87        }
88       
89"/docs/package/detail":
90        publisher: dojo.docs
91        subscriber: Any widget that wishes to be aware of a selection's details
92        message: {
93                        selectKey: identifier
94                        pkg: The package of the function
95                        name: The function name
96                        id: If this has a polymorphic ID, here it is
97                        meta: object of the metadata (as shown in the meta JSON object),
98                        doc: docs (TBD: Things like parameter descriptions, extended description, return description)
99                        sig: Function signature
100        }
101
102Note: docSelectionFunction can return the exact result as returned by docResults. That means that you can do something like
103
104onDocResults: function(result){ if(result.docResults.length == 1){ dojo.event.topic.publish("docFunctionDetail", result.DocResults[0])}}
105
106and expect proper results
107
108Topic Registry
109--------------
110
111dojo.event.topic.registerPublisher("/doc/search");     
112dojo.event.topic.registerPublisher("/doc/results");     
113dojo.event.topic.registerPublisher("/doc/function/select");     
114dojo.event.topic.registerPublisher("/doc/function/details");   
115
116dojo.event.topic.subscribe("/doc/search", dojo.doc, "_onDocSearch");
117dojo.event.topic.subscribe("/doc/function/select", dojo.doc, "_onDocSelectFunction");
118
119In the init of an application that uses dojo.doc and some widgets:
120
121        dojo.addOnLoad(function() {
122                var searchWidget = dojo.widget.byId("SearchWidget");
123    dojo.event.topic.subscribe("docResults", searchWidget, "_onDocResults");
124 
125        var detailWidget= dojo.widget.byId("detailWidget");
126        dojo.event.topic.subscribe("docFunctionDetail",detailWidget,"_onDocFunctionDetail");
127        });
128
129Any widget or code can publish to any of these topics at any time like this:
130
131dojo.event.topic.publish("docSearch",message); 
132
133JSON Objects
134------------
135
136In all of the following examples, a key with "" around it means that it is a text link. That is, it does not change.
137
138This is the full Object structure. *asterisks* indicate that the following is in that file. _underscores_ indicate that the following are skipped on the file system.
139
140*function_names*: {
141        package: {
142                [
143                        function
144                ]
145        }
146},
147package: {
148        _meta_: {
149                *description*: "description", (from comment block)
150                _functions_: {
151                        name: {
152                                id: {
153                                        _meta_: {
154                                                summary: "summary", (Actually saved in the package-level *meta*)
155                                                *description*: "description",
156                                                *src*: "source code"
157                                        },
158                                        *meta*: {
159                                                this: "function",
160                                                inherits: [
161                                                        "package"
162                                                ],
163                                                this_inherits: [
164                                                        "package"
165                                                ],
166                                                object_inherits: [
167                                                        "package"
168                                                ],
169                                                parameters: {
170                                                        name: {
171                                                                type: "type",
172                                                                description: "description" (in local version)
173                                                        }
174                                                },
175                                                returns: {
176                                                        type: "type",
177                                                        description: "description" (in local version)
178                                                }
179                                        }
180                                }
181                        }
182                }
183        },
184        *meta*: {
185                description: "description", (from wiki, only in local version)
186                variables: [
187                        variable: "description", (in local version)
188                ],
189                protovariables: [
190                        variable: "description", (in local version)
191                ],
192                requires: {
193                        environment: [
194                                "require"
195                        ]
196                }
197        }
198}
199
200The wiki
201--------
202
203http://manual.dojotoolkit.org/_/cmd/admin.exportZip?mode=xml&includeRevisions=false
204
205Searching docs
206--------------
207
208Searching docs requires the following options:
209
210* Search Box
211* Hostenv
212* Extra environmental options
213
214Search Box
215----------
216
217This is an autocompleting search box. The values used for autocomplete are found in the "function_name" JSON object in the second level of the object. (eg the values of each value, the methods). As the user types, as long as the entered text matches "dojo." then we limit the autocomplete to functions beginning with that. If this is not true, it searches the entire list.
218
219Hostenv Options
220---------------
221
222A dropdown with hostenvs
223
224Extra environmental options
225---------------------------
226
227The options that aren't set by hostenv (eg "browser" hostenv implies "html" as an option) can be chosen here (eg svg).
228
229Results for dojo.package.* search
230---------------------------------
231
232* Load the package metadata from the pkg_meta directory.
233* Find all function signatures by loading the current file and all packages that are required, paying attention to hostenv.
234
235Results for an exact method match
236---------------------------------
237
238* Load package metadata from the pkg_meta directory. Several things can happen here:
239** If the method has an "is" key, then we need to redirect them to that method.
240** If the method has multiple signatures (more than just the "default" id) then have them choose from a list of methods.
241** If the method has a single signature, go to the method display page.
242
243Results for a match with multiple method matches
244------------------------------------------------
245
246* Go through each matching method in the list, load the pkg_meta for each package and display function signatures and descriptions for all matching methods. Allow the user to click each method.
247
248Method Display Page
249-------------------
250
251The focal point of this page is the source code. Eventually, it will have syntax highlighting. The function signature must be used since the source has none of its own.
252       
253Take a look at the JSON object for method metadata. It holds a lot of the information concerning public variables and inheritance. Public variables are a combination of "this_variables" and "variables". "this_inherits" only inherits variables set by the "this_variables" of the corresponding method.
254       
255From this, build a JavaDoc style layout of inheritance and variables using all the information aggregated so far.
256
257In the near future, even more information will be loaded from a jot site. Also, editing by administrators and comment submission by users will be added. Flagging, etc after that.
Note: See TracBrowser for help on using the browser.