43 | | |
44 | | |
45 | | '''[#example_boostbook Docbook source]''' - ''Required'' |
46 | | |
47 | | * '''[#example_boostbook_xml doc/lib_name.xml]''' |
48 | | [[Br]] Doc source in docbook format. Optionally it can include boostbook extensions. |
49 | | * '''[#example_boostbook_xsl doc/lib_name.xsl]''' |
50 | | [[Br]] Library dependents output configuration parameters (i.e. chunker depth). |
51 | | * '''[#example_boostbook_jamfile doc/Jamfile.v2]''' |
52 | | [[Br]] "doc/bjam --v2" will generate the HTML docs. |
53 | | |
54 | | '''[#example_quickbook Quickbook Source]''' - ''Optional'' |
55 | | |
56 | | * '''[#example_quickbook_main_qbk doc/lib_name.qbk]''' |
57 | | [[Br]] Main quickbook file. |
58 | | * '''[#example_quickbook_moderate_section_qbk doc/*.qbk]''' |
59 | | [[Br]] Moderate size main sections quickbook files |
60 | | * '''[#example_doc_example_qbk doc/larger_section.qbk]''' |
61 | | * '''[#example_doc_example_qbk doc/larger_section/*.qbk]''' |
62 | | [[Br]] Large size main sections (i.e reference) may be splitted again, organizing them |
63 | | in a directory tree to avoid cluttering the '''doc''' directory. |
64 | | |
65 | | '''[http://en.wikipedia.org/wiki/Category:Graphics_file_formats Images]''' - ''Optional'' |
66 | | |
67 | | * '''[http://en.wikipedia.org/wiki/PNG doc/images/*.png]''' |
68 | | [[Br]] You can use other formats, but be a good web citizen and use portable networks graphics. |
69 | | * '''[http://en.wikipedia.org/wiki/Scalable_Vector_Graphics doc/images/*.svg]''' |
70 | | [[Br]] If you intend to have a decent rendering in the pdf docs, use svg. |
71 | | |
72 | | '''[#example_doc_example Examples]''' - ''Optional'' |
73 | | |
74 | | * '''[#example_doc_example_cpp example/doc/*.cpp]''' |
75 | | [[Br]] Quickbook allows us to import code chunks, instead of hard-coding them in the qbk source. |
76 | | This allow as to be sure that every code example will be in sync and with out typos. |
77 | | * '''[#example_doc_example_jamfile example/doc/Jamfile.v2]''' |
78 | | [[Br]] Testsuite for the doc examples. |
79 | | |
80 | | '''[#example_navigation Navigation aid]''' - ''Will be automated in the future'' |
81 | | |
82 | | * '''[#example_navigation_sections_xml doc/html/sections.xml]''' |
83 | | [[Br]] Nested links xml definition of the library sections. This file is used to generate the |
84 | | navigation select boxes and tree sidebar (''expected it soon''). |
85 | | |
86 | | ---- |
87 | | |
88 | | === Library docs organization example === |
89 | | |
90 | | [[PageOutline(4-5,Examples list,inline)]] |
91 | | |
92 | | ==== Docbook source ==== #example_boostbook |
93 | | |
94 | | ===== doc/lib_name.xml ===== #example_boostbook_xml |
95 | | |
96 | | Doc source in docbook format. Optionally it can include boostbook extensions. |
97 | | {{{ |
98 | | <?xml version="1.0" encoding="UTF-8"?> |
99 | | <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> |
100 | | <library id="library_name" name="Boost.LibraryName" dirname="library_name" last-revision="$Date: 2007/06/14 22:18:40 $" |
101 | | xmlns:xi="http://www.w3.org/2001/XInclude"> |
102 | | |
103 | | <libraryinfo> |
104 | | <author> |
105 | | <firstname>name</firstname> <surname>name</surname> |
106 | | </author> |
107 | | <copyright> |
108 | | <year>year</year> <holder>name</holder> |
109 | | </copyright> |
110 | | <legalnotice> |
111 | | <para> |
112 | | Distributed under the Boost Software License, Version 1.0. (See accompanying |
113 | | file LICENSE_1_0.txt or copy at |
114 | | <ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>) |
115 | | </para> |
116 | | </legalnotice> |
117 | | <librarypurpose> |
118 | | Standard boostbook example |
119 | | </librarypurpose> |
120 | | <librarycategory name="category:library_category"></librarycategory> |
121 | | </libraryinfo> |
122 | | |
123 | | <title>Boost.LibraryName</title> |
124 | | |
125 | | <section id="library_name.section_id"> |
126 | | |
127 | | <title>Section Title</title> |
128 | | |
129 | | <para> |
130 | | This is an example of a <emphasis role="bold">standard</emphasis> Boostbook document. |
131 | | An <ulink url="http://www.boost.org">external link</ulink> |
132 | | </para> |
133 | | |
134 | | <para> |
135 | | These should be syntax highlighted: |
136 | | </para> |
137 | | |
138 | | <programlisting> |
139 | | <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">iostream</phrase><phrase role="special">></phrase> |
140 | | |
141 | | <phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase> |
142 | | <phrase role="special">{</phrase> |
143 | | <phrase role="comment">// Sample code |
144 | | </phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"Hello, World\n"</phrase><phrase role="special">;</phrase> |
145 | | <phrase role="keyword">return</phrase> <phrase role="number">0</phrase><phrase role="special">;</phrase> |
146 | | <phrase role="special">}</phrase> |
147 | | |
148 | | </programlisting> |
149 | | |
150 | | </section> |
151 | | |
152 | | </library> |
153 | | }}} |
154 | | |
155 | | ===== doc/lib_name.xsl ===== #example_boostbook_xsl |
156 | | |
157 | | Library dependents output configuration parameters (i.e. chunker depth). |
158 | | {{{ |
159 | | <?xml version="1.0" encoding="utf-8"?> |
160 | | <!-- |
161 | | Copyright (c) Year author name, author name |
162 | | |
163 | | Distributed under the Boost Software License, Version 1.0. |
164 | | (See accompanying file LICENSE_1_0.txt or copy at |
165 | | http://www.boost.org/LICENSE_1_0.txt) |
166 | | --> |
167 | | |
168 | | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
169 | | version="1.0"> |
170 | | |
171 | | <!-- HTML Boostbook parameters --> |
172 | | |
173 | | <xsl:param name = "chapter.logo.img" select = "'../images/library_logo.png'" /> |
174 | | |
175 | | <xsl:param name = "quickbook.source.style.show" select = "'true'" /> |
176 | | |
177 | | <!-- HTML Dockbook parameters --> |
178 | | |
179 | | <xsl:param name = "chunk.section.depth" select = "2" /> |
180 | | |
181 | | </xsl:stylesheet> |
182 | | }}} |
183 | | |
184 | | ===== doc/Jamfile.v2 ===== #example_boostbook_jamfile |
185 | | |
186 | | "doc/bjam --v2" will generate the html docs. |
187 | | {{{ |
188 | | # Boost.LibraryName |
189 | | # |
190 | | # Copyright (c) Years author name, author name |
191 | | # |
192 | | # Distributed under the Boost Software License, Version 1.0. |
193 | | # (See accompanying file LICENSE_1_0.txt or copy at |
194 | | # http://www.boost.org/LICENSE_1_0.txt) |
195 | | |
196 | | using quickbook ; |
197 | | |
198 | | xml library_name |
199 | | : |
200 | | library_name.qbk ; |
201 | | |
202 | | |
203 | | boostbook standalone |
204 | | : |
205 | | library_name |
206 | | : |
207 | | library_name.xsl |
208 | | ; |
209 | | }}} |
210 | | |
211 | | ==== Quickbook Source ==== #example_quickbook |
212 | | |
213 | | ===== doc/lib_name.qbk ===== #example_quickbook_main_qbk |
214 | | |
215 | | Main quickbook file. |
216 | | {{{ |
217 | | [library LibraryName |
218 | | [quickbook 1.4] |
219 | | [copyright Year author name, author name] |
220 | | [purpose Standard qbk example] |
221 | | [id library_name] |
222 | | [dirname library_name] |
223 | | [license |
224 | | Distributed under the Boost Software License, Version 1.0. |
225 | | (See accompanying file LICENSE_1_0.txt or copy at |
226 | | [http://www.boost.org/LICENSE_1_0.txt]) |
227 | | ] |
228 | | [authors [surname, firstname], [surname, firstname] ] |
229 | | [category library_category] |
230 | | ] |
231 | | |
232 | | [/ Templates ] |
233 | | |
234 | | [/ Images ] |
235 | | |
236 | | [template Diagram [$../images/diagram.png]] |
237 | | |
238 | | [/ External Links ] |
239 | | |
240 | | [template SgiAssignable [@http://www.sgi.com/tech/stl/Assignable.html Assignable]] |
241 | | |
242 | | [/ Sections ] |
243 | | |
244 | | [section Small Section] |
245 | | |
246 | | A few lines. |
247 | | A nice diagram of the lib: |
248 | | [Diagram] |
249 | | |
250 | | [endsect] |
251 | | |
252 | | [/ Moderate section abstract ] |
253 | | [include moderate_size_section.qbk] |
254 | | |
255 | | [/ Larger section abstract ] |
256 | | [include larger_size_section.qbk] |
257 | | |
258 | | [section Other Small Section] |
259 | | |
260 | | Some more lines. |
261 | | An external resource: [SgiAssignable] |
262 | | |
263 | | [endsect] |
264 | | }}} |
265 | | |
266 | | ===== doc/moderate_section.qbk ===== #example_quickbook_moderate_section_qbk |
267 | | |
268 | | Moderate size main sections quickbook files |
269 | | {{{ |
270 | | [/ |
271 | | Boost.LibrayName |
272 | | Copyright (c) Year author name |
273 | | |
274 | | Distributed under the Boost Software License, Version 1.0. |
275 | | (See accompanying file LICENSE_1_0.txt or copy at |
276 | | http://www.boost.org/LICENSE_1_0.txt) |
277 | | ] |
278 | | |
279 | | [/ QuickBook Document version 1.4 ] |
280 | | |
281 | | [/ Section specifics templates ] |
282 | | |
283 | | [template ModerateSizeImage [$../images/moderate_size_image.svg] |
284 | | |
285 | | [/ Sections ] |
286 | | |
287 | | [section Moderate section] |
288 | | |
289 | | You can use this sections templates to show an image: |
290 | | [ModerateSizeImage] |
291 | | |
292 | | Main templates are allowed too, reuse [SgiAssignable]. |
293 | | |
294 | | A nice table, including marketting stuff |
295 | | |
296 | | [table Quickbook Rocks |
297 | | |
298 | | [[Feature ][Purpose ]] |
299 | | |
300 | | [[Templates ][Extensibility and constants ]] |
301 | | [[Code import ][Code consistency, callouts and reuse ]] |
302 | | [[Wiki style formating ][High signal to noise ratio in source code ]] |
303 | | [[Internal links ][Easy to use inter-doc anchors ]] |
304 | | [[Syntax Highlighting ][Both in code blocks and in `inline code` ]] |
305 | | |
306 | | ] |
307 | | |
308 | | [endsect] |
309 | | }}} |
310 | | |
311 | | ==== Doc Examples ==== #example_doc_example |
312 | | |
313 | | ===== example/doc/code_example.cpp ===== #example_doc_example_cpp |
314 | | |
315 | | Quickbook allows us to import code chunks, instead of hard-coding them in the qbk source. |
316 | | This allow as to be sure that every code example will be in sync and with out typos. |
317 | | {{{ |
318 | | // Boost.LibraryName |
319 | | // |
320 | | // Copyright (c) Year author name, author name |
321 | | // |
322 | | // Distributed under the Boost Software License, Version 1.0. |
323 | | // (See accompanying file LICENSE_1_0.txt or copy at |
324 | | // http://www.boost.org/LICENSE_1_0.txt) |
325 | | |
326 | | // Doc example |
327 | | |
328 | | #include <string> |
329 | | #include <iostream> |
330 | | |
331 | | //[ DocCodeFunctionName |
332 | | |
333 | | std::string greeting() |
334 | | { |
335 | | return "Hello world!"; |
336 | | } |
337 | | |
338 | | //] |
339 | | |
340 | | //[ DocCodeExampleName |
341 | | |
342 | | int main() |
343 | | { |
344 | | /*<< A callout bug >>*/ |
345 | | std::string message = greeting(); |
346 | | std::cout << message; /*< Inlined callout bug >*/ |
347 | | } |
348 | | |
349 | | //] |
350 | | }}} |
351 | | |
352 | | ===== doc/larger_section.qbk ===== #example_doc_example_qbk |
353 | | |
354 | | {{{ |
355 | | [/ |
356 | | Boost.LibrayName |
357 | | Copyright (c) Year author name |
358 | | |
359 | | Distributed under the Boost Software License, Version 1.0. |
360 | | (See accompanying file LICENSE_1_0.txt or copy at |
361 | | http://www.boost.org/LICENSE_1_0.txt) |
362 | | ] |
363 | | |
364 | | [/ QuickBook Document version 1.4 ] |
365 | | |
366 | | [/ Section specifics code ] |
367 | | |
368 | | [import ../example/doc/example_name.cpp] |
369 | | |
370 | | [/ Sections ] |
371 | | |
372 | | [section Larger section] |
373 | | |
374 | | [section Introduction] |
375 | | |
376 | | A few lines. |
377 | | We can easily use the imported code: |
378 | | |
379 | | [DocCodeFunctionName] |
380 | | |
381 | | And then the main function |
382 | | |
383 | | [DocCodeExampleName] |
384 | | |
385 | | That is it! |
386 | | |
387 | | [endsect] |
388 | | |
389 | | [include larger_section/subsection_name.qbk] |
390 | | |
391 | | [endsect] |
392 | | }}} |
393 | | |
394 | | ===== example/doc/Jamfile.v2 ===== #example_doc_example_jamfile |
395 | | |
396 | | Testsuite for the doc examples. |
397 | | {{{ |
398 | | # Boost.LibraryName |
399 | | # |
400 | | # Copyright (c) Years author name, author name |
401 | | # |
402 | | # Distributed under the Boost Software License, Version 1.0. |
403 | | # (See accompanying file LICENSE_1_0.txt or copy at |
404 | | # http://www.boost.org/LICENSE_1_0.txt) |
405 | | |
406 | | import testing ; |
407 | | |
408 | | test-suite "doc_code" |
409 | | : |
410 | | [ compile compilable_example.cpp ] |
411 | | [ run runable_example.cpp ] |
412 | | [ compile-fail compile_fail_example.cpp ] |
413 | | ; |
414 | | }}} |
415 | | |
416 | | ==== Navigation aid ==== #example_navigation |
417 | | |
418 | | ===== doc/html/sections.xml ===== #example_navigation_sections_xml |
419 | | |
420 | | Nested links xml definition of the library sections. This file is used to generate the |
421 | | navigation select boxes and tree sidebar (''expected it soon!''). |
422 | | {{{ |
423 | | <?xml version="1.0" encoding="UTF-8" ?> |
424 | | |
425 | | <!-- |
426 | | Boost.LibraryName Sections |
427 | | |
428 | | Copyright (c) Year author name, author name |
429 | | |
430 | | Distributed under the Boost Software License, Version 1.0. |
431 | | (See accompanying file LICENSE_1_0.txt or copy at |
432 | | http://www.boost.org/LICENSE_1_0.txt) |
433 | | --> |
434 | | |
435 | | <nestedLinks version="1.0"> |
436 | | |
437 | | <title tag="Sections" href="index.html" /> |
438 | | |
439 | | <link tag="Introduction" href="library_name/introduction.html" /> |
440 | | <link tag="Moderate size section" href="library_name/moderate_section.html" > |
441 | | <link tag="First Subsection" href="library_name/moderate_section/first_subsection.html" /> |
442 | | <link tag="Second Subsection" href="library_name/moderate_section/second_subsection.html" /> |
443 | | <link tag="Last Subsection" href="library_name/moderate_section/last_subsection.html" /> |
444 | | </link> |
445 | | <link tag="Larger size section" href="library_name/larger_section.html" > |
446 | | <link tag="First Subsection" href="library_name/larger_section/first_subsection.html" /> |
447 | | <link tag="Second Subsection" href="library_name/larger_section/second_subsection.html" > |
448 | | <link tag="Deeper section" href="library_name/.../deeper_section.html" /> |
449 | | </link> |
450 | | <link tag="Last Subsection" href="library_name/larger_section/last_subsection.html" /> |
451 | | </link> |
452 | | <link tag="Acknowledgments" href="library_name/acknowledgments.html" /> |
453 | | |
454 | | </nestedLinks> |
455 | | }}} |
456 | | |