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