| [12] | 1 | [part quickbook | 
|---|
 | 2 |     [version 1.1] | 
|---|
 | 3 |     [authors [de Guzman, Joel], [Niebler, Eric]] | 
|---|
 | 4 |     [copyright 2002 2004 Joel de Guzman, Eric Niebler] | 
|---|
 | 5 |     [purpose WikiWiki style documentation tool] | 
|---|
 | 6 |     [license | 
|---|
 | 7 |         Distributed under the Boost Software License, Version 1.0. | 
|---|
 | 8 |         (See accompanying file LICENSE_1_0.txt or copy at | 
|---|
 | 9 |         <ulink url="http://www.boost.org/LICENSE_1_0.txt"> | 
|---|
 | 10 |             http://www.boost.org/LICENSE_1_0.txt | 
|---|
 | 11 |         </ulink>) | 
|---|
 | 12 |     ] | 
|---|
 | 13 |     [last-revision $Date: 2005/04/30 01:48:44 $] | 
|---|
 | 14 | ] | 
|---|
 | 15 |  | 
|---|
 | 16 | [/ QuickBook Document version 1.1 ] | 
|---|
 | 17 | [/ Sept 24, 2002 ] | 
|---|
 | 18 | [/ Sept 2, 2004 ] | 
|---|
 | 19 | [/ Feb 14, 2005 ] | 
|---|
 | 20 |  | 
|---|
 | 21 | [/ Some links] | 
|---|
 | 22 |  | 
|---|
 | 23 | [def __note__       [$images/note.png]] | 
|---|
 | 24 | [def __alert__      [$images/alert.png]] | 
|---|
 | 25 | [def __tip__        [$images/tip.png]] | 
|---|
 | 26 | [def :-)            [$images/smiley.png]] | 
|---|
 | 27 | [def __spirit__     [@http://spirit.sourceforge.net Spirit]] | 
|---|
 | 28 | [def __boostbook__  [@http://www.boost.org/doc/html/boostbook.html BoostBook]] | 
|---|
 | 29 | [def __docbook__    [@http://www.docbook.org/ DocBook]] | 
|---|
 | 30 |  | 
|---|
 | 31 | [section:intro Introduction] | 
|---|
 | 32 |  | 
|---|
 | 33 | [:[*['"Why program by hand in five days what you can spend five years of your | 
|---|
 | 34 | life automating?"]]\n\n-- Terrence Parr, author ANTLR/PCCTS] | 
|---|
 | 35 |  | 
|---|
 | 36 | Well, QuickBook started as a weekend hack. It was originally intended to be a | 
|---|
 | 37 | sample application using __spirit__. What is it? What you are viewing now, this | 
|---|
 | 38 | documentation, is autogenerated by QuickBook. These files were generated from | 
|---|
 | 39 | one master: | 
|---|
 | 40 |  | 
|---|
 | 41 | [:[@../quickbook.qbk quickbook.qbk]] | 
|---|
 | 42 |  | 
|---|
 | 43 | Originally named QuickDoc, this funky tool that never dies evolved into a | 
|---|
 | 44 | funkier tool thanks to Eric Niebler who resurrected the project making it | 
|---|
 | 45 | generate __boostbook__ instead of HTML. The __boostbook__ documentation format | 
|---|
 | 46 | is an extension of __docbook__, an SGML- or XML- based format for describing | 
|---|
 | 47 | documentation. | 
|---|
 | 48 |  | 
|---|
 | 49 | QuickBook is a WikiWiki style documentation tool geared towards C++ | 
|---|
 | 50 | documentation using simple rules and markup for simple formatting tasks. | 
|---|
 | 51 | QuickBook extends the WikiWiki concept. Like the WikiWiki, QuickBook documents are | 
|---|
 | 52 | simple text files. A single QuickBook document can generate a fully linked set | 
|---|
 | 53 | of nice HTML and PostScript/PDF documents complete with images and syntax- | 
|---|
 | 54 | colorized source code. | 
|---|
 | 55 |  | 
|---|
 | 56 | Features include: | 
|---|
 | 57 |  | 
|---|
 | 58 | * generate __boostbook__ xml, to generate HTML, PostScript and PDF | 
|---|
 | 59 | * simple markup to link to Doxygen-generated entities | 
|---|
 | 60 | * macro system for simple text substitution | 
|---|
 | 61 | * simple markup for italics, bold, preformatted, blurbs, code samples, | 
|---|
 | 62 |   tables, URLs, anchors, images, etc. | 
|---|
 | 63 | * automatic syntax coloring of code samples | 
|---|
 | 64 | * CSS support | 
|---|
 | 65 |  | 
|---|
 | 66 | [endsect] | 
|---|
 | 67 | [section:syntax Syntax Summary] | 
|---|
 | 68 |  | 
|---|
 | 69 | A QuickBook document is composed of one or more blocks. An example of | 
|---|
 | 70 | a block is the paragraph or a C++ code snippet. Some blocks have | 
|---|
 | 71 | special mark-ups. Blocks, except code snippets which have their own | 
|---|
 | 72 | grammar (C++ or Python), are composed of one or more phrases. A phrase | 
|---|
 | 73 | can be a simple contiguous run of characters. Phrases can have special | 
|---|
 | 74 | mark-ups. Marked up phrases can recursively contain other phrases, but | 
|---|
 | 75 | cannot contain blocks. A terminal is a self contained block-level or | 
|---|
 | 76 | phrase- level element that does not nest anything. | 
|---|
 | 77 |  | 
|---|
 | 78 | Blocks, in general, are delimited by two end-of-lines (the block terminator). | 
|---|
 | 79 | Phrases in each block cannot contain a block terminator. This way, syntax errors | 
|---|
 | 80 | such as un-matched closing brackets do not go haywire and corrupt anything past | 
|---|
 | 81 | a single block. | 
|---|
 | 82 |  | 
|---|
 | 83 | [h2 Comments] | 
|---|
 | 84 |  | 
|---|
 | 85 | Can be placed anywhere. | 
|---|
 | 86 |  | 
|---|
 | 87 | [pre | 
|---|
 | 88 | '''[/ comment (no output generated) ]''' | 
|---|
 | 89 | ] | 
|---|
 | 90 |  | 
|---|
 | 91 | [h2 Phrase Level Elements] | 
|---|
 | 92 |  | 
|---|
 | 93 | [h3 Font Styles] | 
|---|
 | 94 |  | 
|---|
 | 95 | [pre''' | 
|---|
 | 96 | ['italic], [*bold], [_underline], [^teletype] | 
|---|
 | 97 | '''] | 
|---|
 | 98 |  | 
|---|
 | 99 | will generate: | 
|---|
 | 100 |  | 
|---|
 | 101 | ['italic], [*bold], [_underline], [^teletype] | 
|---|
 | 102 |  | 
|---|
 | 103 | Like all non-terminal phrase level elements, this can of course be nested: | 
|---|
 | 104 |  | 
|---|
 | 105 | [pre''' | 
|---|
 | 106 | [*['bold-italic]] | 
|---|
 | 107 | '''] | 
|---|
 | 108 |  | 
|---|
 | 109 | will generate: | 
|---|
 | 110 |  | 
|---|
 | 111 | [*['bold-italic]] | 
|---|
 | 112 |  | 
|---|
 | 113 | [h3 Simple formatting] | 
|---|
 | 114 |  | 
|---|
 | 115 | Simple markup for formatting text, common in many applications, is now supported: | 
|---|
 | 116 |  | 
|---|
 | 117 | [pre''' | 
|---|
 | 118 | /italic/, *bold*, _underline_, =teletype= | 
|---|
 | 119 | '''] | 
|---|
 | 120 |  | 
|---|
 | 121 | will generate: | 
|---|
 | 122 |  | 
|---|
 | 123 | /italic/, *bold*, _underline_, =teletype= | 
|---|
 | 124 |  | 
|---|
 | 125 | Unlike QuickBook's standard formatting scheme, the rules for simpler alternatives | 
|---|
 | 126 | are much stricter. | 
|---|
 | 127 |  | 
|---|
 | 128 | * Simple markups cannot nest. You can combine a simple markup with a nestable markup. | 
|---|
 | 129 | * A non-space character must follow the leading markup | 
|---|
 | 130 | * A non-space character must precede the trailing markup | 
|---|
 | 131 | * A space or a punctuation must follow the trailing markup | 
|---|
 | 132 | * If the matching markup cannot be found within a line, the formatting | 
|---|
 | 133 |   will not be applied. This is to ensure that un-matched formatting markups, | 
|---|
 | 134 |   which can be a common mistake, does not corrupt anything past a single line. | 
|---|
 | 135 |   We do not want the rest of the document to be rendered bold just because we | 
|---|
 | 136 |   forgot a trailing '*'. | 
|---|
 | 137 | * A line starting with the star will be interpreted as an unordered list. | 
|---|
 | 138 |   See [link syntax.unordered_lists Unordered lists]. | 
|---|
 | 139 |  | 
|---|
 | 140 | [table More Formatting Samples | 
|---|
 | 141 |     [[Markup]                                           [Result]] | 
|---|
 | 142 |     [[[^'''*Bold*''']]                                  [*Bold*]] | 
|---|
 | 143 |     [[[^'''*Is bold*''']]                               [*Is bold*]] | 
|---|
 | 144 |     [[[^'''* Not bold* *Not bold * * Not bold *''']]    [* Not bold* *Not bold * * Not bold *]] | 
|---|
 | 145 |     [[[^'''This*Isn't*Bold (no bold)''']]               [This*Isn't*Bold (no bold)]] | 
|---|
 | 146 |     [[[^'''(*Bold Inside*) (parenthesis not bold)''']]  [(*Bold Inside*) (parenthesis not bold)]] | 
|---|
 | 147 |     [[[^'''*(Bold Outside)* (parenthesis bold)''']]     [*(Bold Outside)* (parenthesis bold)]] | 
|---|
 | 148 |     [[[^'''3*4*5 = 60 (no bold)''']]                    [3*4*5 = 60 (no bold)]] | 
|---|
 | 149 |     [[[^'''3 * 4 * 5 = 60 (no bold)''']]                [3 * 4 * 5 = 60 (no bold)]] | 
|---|
 | 150 |     [[[^'''3 *4* 5 = 60 (4 is bold)''']]                [3 *4* 5 = 60 (4 is bold)]] | 
|---|
 | 151 |     [[[^'''*This is bold* this is not *but this is*''']][*This is bold* this is not *but this is*]] | 
|---|
 | 152 |     [[[^'''*This is bold*.''']]                         [*This is bold*.]] | 
|---|
 | 153 |     [[[^'''*B*. (bold B)''']]                           [*B*. (bold B)]] | 
|---|
 | 154 |     [[[^'''['*Bold-Italic*]''']]                        [['*Bold-Italic*]]] | 
|---|
 | 155 | ] | 
|---|
 | 156 |  | 
|---|
 | 157 | [blurb __note__ Thanks to David Barrett, author of | 
|---|
 | 158 | [@http://quinthar.com/qwikiwiki/index.php?page=Home Qwiki], for sharing these samples | 
|---|
 | 159 | and teaching me these obscure formatting rules. I wasn't sure at all if __spirit__, | 
|---|
 | 160 | being more or less a formal EBNF parser, can handle the context sensitivity and ambiguity.] | 
|---|
 | 161 |  | 
|---|
 | 162 | [h3 Inline code] | 
|---|
 | 163 |  | 
|---|
 | 164 | Inlining code in paragraphs is quite common when writing C++ documentation. We | 
|---|
 | 165 | provide a very simple markup for this. For example, this: | 
|---|
 | 166 |  | 
|---|
 | 167 | [pre''' | 
|---|
 | 168 | This text has inlined code `int main() { return 0; }` in it. | 
|---|
 | 169 | '''] | 
|---|
 | 170 |  | 
|---|
 | 171 | will generate: | 
|---|
 | 172 |  | 
|---|
 | 173 | This text has inlined code `int main() { return 0; }` in it. The code will be | 
|---|
 | 174 | syntax highlighted. | 
|---|
 | 175 |  | 
|---|
 | 176 | [blurb __note__ | 
|---|
 | 177 | Note that we simply enclose the code with the tick: [^'''"`"'''], not the | 
|---|
 | 178 | single quote: `"'"`. Note too that [^'''`some code`'''] is prefered over | 
|---|
 | 179 | [^'''[^some code]''']. | 
|---|
 | 180 | ] | 
|---|
 | 181 |  | 
|---|
 | 182 | [h3 Source Mode] | 
|---|
 | 183 |  | 
|---|
 | 184 | If a document contains more than one type of source code then the source mode | 
|---|
 | 185 | may be changed dynamically as the document is processed. All QuickBook | 
|---|
 | 186 | documents are initially in C++ mode by default, though an alternative initial value  | 
|---|
 | 187 | may be set in the [link syntax.document Document Info] section. | 
|---|
 | 188 |  | 
|---|
 | 189 | To change the source mode, use the [^\[source-mode\]] markup, where | 
|---|
 | 190 | =source-mode= is one of the supported modes. For example, this: | 
|---|
 | 191 |  | 
|---|
 | 192 | [pre''' | 
|---|
 | 193 | Python's [python] `import` is rather like C++'s [c++] `#include`. A | 
|---|
 | 194 | C++ comment `// looks like this` whereas a Python comment [python] | 
|---|
 | 195 | `# looks like this`. | 
|---|
 | 196 | '''] | 
|---|
 | 197 |  | 
|---|
 | 198 | will generate: | 
|---|
 | 199 |  | 
|---|
 | 200 | Python's [python] `import` is rather like C++'s [c++] `#include`. A | 
|---|
 | 201 | C++ comment `// looks like this` whereas a Python comment [python] | 
|---|
 | 202 | `#looks like this`. | 
|---|
 | 203 |  | 
|---|
 | 204 | [table Supported Source Modes | 
|---|
 | 205 |     [[Mode]                 [Source Mode Markup]] | 
|---|
 | 206 |     [[C++]                  [[^\[c++\]]]] | 
|---|
 | 207 |     [[Python]               [[^\[python\]]]] | 
|---|
 | 208 | ] | 
|---|
 | 209 |  | 
|---|
 | 210 | [blurb __note__ The source mode strings are lowercase.] | 
|---|
 | 211 |  | 
|---|
 | 212 | [h3 line-break] | 
|---|
 | 213 |  | 
|---|
 | 214 | [pre''' | 
|---|
 | 215 | [br] | 
|---|
 | 216 | '''] | 
|---|
 | 217 |  | 
|---|
 | 218 | [blurb __note__ Note that `\n` is now preferred over `[br]`.] | 
|---|
 | 219 |  | 
|---|
 | 220 | [h3 Anchors] | 
|---|
 | 221 |  | 
|---|
 | 222 | [pre''' | 
|---|
 | 223 | [#named_anchor] | 
|---|
 | 224 | '''] | 
|---|
 | 225 |  | 
|---|
 | 226 | A named anchor is a hook that can be referenced by a link elsewhere in the | 
|---|
 | 227 | document. You can then reference an anchor with [^'''[link named_anchor Some link text]''']. | 
|---|
 | 228 | More on anchors [link syntax.anchor_links here], [link syntax.section here] and | 
|---|
 | 229 | [link syntax.headings here]. | 
|---|
 | 230 |  | 
|---|
 | 231 | [h3 Links] | 
|---|
 | 232 |  | 
|---|
 | 233 | [pre''' | 
|---|
 | 234 | [@http://www.boost.org this is [*boost's] website....] | 
|---|
 | 235 | '''] | 
|---|
 | 236 |  | 
|---|
 | 237 | will generate: | 
|---|
 | 238 |  | 
|---|
 | 239 | [@http://www.boost.org this is [*boost's] website....] | 
|---|
 | 240 |  | 
|---|
 | 241 | URL links where the link text is the link itself is common. Example: | 
|---|
 | 242 |  | 
|---|
 | 243 | [pre''' | 
|---|
 | 244 | see http://spirit.sourceforge.net/ | 
|---|
 | 245 | '''] | 
|---|
 | 246 |  | 
|---|
 | 247 | so, when the text is absent in a link markup, the URL is assumed. Example: | 
|---|
 | 248 |  | 
|---|
 | 249 | [pre | 
|---|
 | 250 | see '''[@http://spirit.sourceforge.net/]''' | 
|---|
 | 251 | ] | 
|---|
 | 252 |  | 
|---|
 | 253 | will generate: | 
|---|
 | 254 |  | 
|---|
 | 255 | see [@http://spirit.sourceforge.net/] | 
|---|
 | 256 |  | 
|---|
 | 257 | [h3 Anchor links] | 
|---|
 | 258 |  | 
|---|
 | 259 | You can link within a document using: | 
|---|
 | 260 |  | 
|---|
 | 261 | [pre''' | 
|---|
 | 262 | [link section_id.normalized_header_text The link text] | 
|---|
 | 263 | '''] | 
|---|
 | 264 |  | 
|---|
 | 265 | See sections [link syntax.section Section] and [link syntax.headings Headings] | 
|---|
 | 266 | for more info. | 
|---|
 | 267 |  | 
|---|
 | 268 | [h3 refentry links] | 
|---|
 | 269 |  | 
|---|
 | 270 | In addition, you can link internally to an XML refentry like: | 
|---|
 | 271 |  | 
|---|
 | 272 | [pre''' | 
|---|
 | 273 | [link xml.refentry The link text] | 
|---|
 | 274 | '''] | 
|---|
 | 275 |  | 
|---|
 | 276 | This gets converted into [^<link linkend="xml.refentry">The link text</link>]. | 
|---|
 | 277 |  | 
|---|
 | 278 | Like URLs, the link text is optional. If this is not present, the link text will | 
|---|
 | 279 | automatically be the refentry. Example: | 
|---|
 | 280 |  | 
|---|
 | 281 | [pre''' | 
|---|
 | 282 | [link xml.refentry] | 
|---|
 | 283 | '''] | 
|---|
 | 284 |  | 
|---|
 | 285 | This gets converted into [^<link linkend="xml.refentry">xml.refentry</link>]. | 
|---|
 | 286 |  | 
|---|
 | 287 | [h3 function, class, member, enum or header links] | 
|---|
 | 288 |  | 
|---|
 | 289 | If you want to link to a function, class, member, enum or header in the reference | 
|---|
 | 290 | section, you can use: | 
|---|
 | 291 |  | 
|---|
 | 292 | [pre''' | 
|---|
 | 293 | [funcref fully::qualified::function_name The link text] | 
|---|
 | 294 | [classref fully::qualified::class_name The link text] | 
|---|
 | 295 | [memberref fully::qualified::member_name The link text] | 
|---|
 | 296 | [enumref fully::qualified::enum_name The link text] | 
|---|
 | 297 | [headerref path/to/header.hpp The link text] | 
|---|
 | 298 | '''] | 
|---|
 | 299 |  | 
|---|
 | 300 | Again, the link text is optional. If this is not present, the link text will | 
|---|
 | 301 | automatically be the function, class, member or enum. Example: | 
|---|
 | 302 |  | 
|---|
 | 303 | [pre''' | 
|---|
 | 304 | [classref boost::bar::baz] | 
|---|
 | 305 | '''] | 
|---|
 | 306 |  | 
|---|
 | 307 | would have "boost::bar::baz" as the link text. | 
|---|
 | 308 |  | 
|---|
 | 309 | [h3 Escape] | 
|---|
 | 310 |  | 
|---|
 | 311 | The escape mark-up is used when we don't want to do any processing. | 
|---|
 | 312 |  | 
|---|
 | 313 | [pre | 
|---|
 | 314 | \'\'\' | 
|---|
 | 315 | escape (no processing/formatting) | 
|---|
 | 316 | \'\'\' | 
|---|
 | 317 | ] | 
|---|
 | 318 |  | 
|---|
 | 319 | Escaping allows us to pass XML markup to __boostbook__ or __docbook__. For example: | 
|---|
 | 320 |  | 
|---|
 | 321 | [pre | 
|---|
 | 322 | \'\'\' | 
|---|
 | 323 | <emphasis role="bold">This is direct XML markup</emphasis> | 
|---|
 | 324 | \'\'\' | 
|---|
 | 325 | ] | 
|---|
 | 326 |  | 
|---|
 | 327 | ''' | 
|---|
 | 328 | <emphasis role="bold">This is direct XML markup</emphasis> | 
|---|
 | 329 | ''' | 
|---|
 | 330 |  | 
|---|
 | 331 | [blurb __alert__ Be careful when using the escape. The text must conform to | 
|---|
 | 332 | __boostbook__/__docbook__ syntax.] | 
|---|
 | 333 |  | 
|---|
 | 334 | [h3 Single char escape] | 
|---|
 | 335 |  | 
|---|
 | 336 | The backslash may be used to escape a single punctuation character. The | 
|---|
 | 337 | punctuation immediately after the backslash is passed without any processing. | 
|---|
 | 338 | This is useful when we need to escape QuickBook punctuations such as `[` and `]`. | 
|---|
 | 339 | For example, how do you escape the triple quote? Simple: [^\\'\\'\\'] | 
|---|
 | 340 |  | 
|---|
 | 341 | `\n` has a special meaning. It is used to generate line breaks. Note that `\n` | 
|---|
 | 342 | is now preferred over `[br]`. | 
|---|
 | 343 |  | 
|---|
 | 344 | [h3 Images (terminal)] | 
|---|
 | 345 |  | 
|---|
 | 346 | [pre''' | 
|---|
 | 347 | [$image.jpg] | 
|---|
 | 348 | '''] | 
|---|
 | 349 |  | 
|---|
 | 350 | [h2 Block Level Elements] | 
|---|
 | 351 |  | 
|---|
 | 352 | [h3 Document] | 
|---|
 | 353 |  | 
|---|
 | 354 | Every document must begin with a Document Info section, which should look | 
|---|
 | 355 | like this: | 
|---|
 | 356 |  | 
|---|
 | 357 | [pre''' | 
|---|
 | 358 | [document-type The Document Title | 
|---|
 | 359 |     [version 1.0] | 
|---|
 | 360 |     [id the_document_name] | 
|---|
 | 361 |     [dirname the_document_dir] | 
|---|
 | 362 |     [copyright 2000 2002 2003 Joe Blow, Jane Doe] | 
|---|
 | 363 |     [purpose The document's reason for being] | 
|---|
 | 364 |     [category The document's category] | 
|---|
 | 365 |     [authors [Blow, Joe], [Doe, Jane]] | 
|---|
 | 366 |     [license The document's license] | 
|---|
 | 367 |     [last-revision $Date: 2005/04/30 01:48:44 $] | 
|---|
 | 368 |     [source-mode source-type] | 
|---|
 | 369 | ] | 
|---|
 | 370 | '''] | 
|---|
 | 371 |  | 
|---|
 | 372 | Where document-type is one of: | 
|---|
 | 373 |  | 
|---|
 | 374 | * book | 
|---|
 | 375 | * library | 
|---|
 | 376 | * part | 
|---|
 | 377 | * article | 
|---|
 | 378 | * chapter | 
|---|
 | 379 |  | 
|---|
 | 380 | and =version=, =id=, =dirname=, =copyright=, =purpose=, =category=, =authors=, | 
|---|
 | 381 | =license=, =last-revision= and =source-mode= are optional information. | 
|---|
 | 382 |  | 
|---|
 | 383 | Here =source-type= is a lowercase string setting the initial  | 
|---|
 | 384 | [link syntax.source_mode source mode]. If the =source-mode= field is omitted, a | 
|---|
 | 385 | default value of =c++= will be used. | 
|---|
 | 386 |  | 
|---|
 | 387 | [h3 Section] | 
|---|
 | 388 |  | 
|---|
 | 389 | Starting a new section is accomplished with: | 
|---|
 | 390 |  | 
|---|
 | 391 | [pre''' | 
|---|
 | 392 | [section:id The Section Title] | 
|---|
 | 393 | '''] | 
|---|
 | 394 |  | 
|---|
 | 395 | where /id/ is optional. id will be the filename of the generated section. | 
|---|
 | 396 | If it is not present, "The Section Title" will be normalized and become the id. | 
|---|
 | 397 | Valid characters are =a-Z=, =A-Z=, =0-9= and =_=. All non-valid characters are | 
|---|
 | 398 | converted to underscore and all upper-case are converted to lower case. | 
|---|
 | 399 | Thus: "The Section Title" will be normalized to "the_section_title". | 
|---|
 | 400 |  | 
|---|
 | 401 | End a section with: | 
|---|
 | 402 |  | 
|---|
 | 403 | [pre''' | 
|---|
 | 404 | [endsect] | 
|---|
 | 405 | '''] | 
|---|
 | 406 |  | 
|---|
 | 407 | Sections can nest, and that results in a hierarchy in the table of contents. | 
|---|
 | 408 |  | 
|---|
 | 409 | [h3 xinclude] | 
|---|
 | 410 |  | 
|---|
 | 411 | You can include another XML file with: | 
|---|
 | 412 |  | 
|---|
 | 413 | [pre''' | 
|---|
 | 414 | [xinclude file.xml] | 
|---|
 | 415 | '''] | 
|---|
 | 416 |  | 
|---|
 | 417 | This is useful when file.xml has been generated by Doxygen and contains your | 
|---|
 | 418 | reference section. | 
|---|
 | 419 |  | 
|---|
 | 420 | [h3 Paragraphs] | 
|---|
 | 421 |  | 
|---|
 | 422 | Paragraphs start left-flushed and are terminated by two or more newlines. No | 
|---|
 | 423 | markup is needed for paragraphs. QuickBook automatically detects paragraphs from | 
|---|
 | 424 | the context. | 
|---|
 | 425 |  | 
|---|
 | 426 | [h3 Ordered lists] | 
|---|
 | 427 |  | 
|---|
 | 428 | [pre | 
|---|
 | 429 | # One | 
|---|
 | 430 | # Two | 
|---|
 | 431 | # Three | 
|---|
 | 432 | ] | 
|---|
 | 433 |  | 
|---|
 | 434 | will generate: | 
|---|
 | 435 |  | 
|---|
 | 436 | # One | 
|---|
 | 437 | # Two | 
|---|
 | 438 | # Three | 
|---|
 | 439 |  | 
|---|
 | 440 | [h3 List Hierarchies] | 
|---|
 | 441 |  | 
|---|
 | 442 | List hierarchies are supported. Example: | 
|---|
 | 443 |  | 
|---|
 | 444 | [pre | 
|---|
 | 445 | # One | 
|---|
 | 446 | # Two | 
|---|
 | 447 | # Three | 
|---|
 | 448 |     # Three.a | 
|---|
 | 449 |     # Three.b | 
|---|
 | 450 |     # Three.c | 
|---|
 | 451 | # Four | 
|---|
 | 452 |     # Four.a | 
|---|
 | 453 |         # Four.a.i | 
|---|
 | 454 |         # Four.a.ii | 
|---|
 | 455 | # Five | 
|---|
 | 456 | ] | 
|---|
 | 457 |  | 
|---|
 | 458 | will generate: | 
|---|
 | 459 |  | 
|---|
 | 460 | # One | 
|---|
 | 461 | # Two | 
|---|
 | 462 | # Three | 
|---|
 | 463 |     # Three.a | 
|---|
 | 464 |     # Three.b | 
|---|
 | 465 |     # Three.c | 
|---|
 | 466 | # Fourth | 
|---|
 | 467 |     # Four.a | 
|---|
 | 468 |         # Four.a.i | 
|---|
 | 469 |         # Four.a.ii | 
|---|
 | 470 | # Five | 
|---|
 | 471 |  | 
|---|
 | 472 | [h3 Long List Lines] | 
|---|
 | 473 |  | 
|---|
 | 474 | Long lines will be wrapped appropriately. Example: | 
|---|
 | 475 |  | 
|---|
 | 476 | [pre | 
|---|
 | 477 | # A short item. | 
|---|
 | 478 | # A very long item. A very long item. A very long item. | 
|---|
 | 479 |   A very long item. A very long item. A very long item. | 
|---|
 | 480 |   A very long item. A very long item. A very long item. | 
|---|
 | 481 |   A very long item. A very long item. A very long item. | 
|---|
 | 482 |   A very long item. A very long item. A very long item. | 
|---|
 | 483 | # A short item. | 
|---|
 | 484 | ] | 
|---|
 | 485 |  | 
|---|
 | 486 | # A short item. | 
|---|
 | 487 | # A very long item. A very long item. A very long item. | 
|---|
 | 488 |   A very long item. A very long item. A very long item. | 
|---|
 | 489 |   A very long item. A very long item. A very long item. | 
|---|
 | 490 |   A very long item. A very long item. A very long item. | 
|---|
 | 491 |   A very long item. A very long item. A very long item. | 
|---|
 | 492 | # A short item. | 
|---|
 | 493 |  | 
|---|
 | 494 | [h3 Unordered lists] | 
|---|
 | 495 |  | 
|---|
 | 496 | [pre''' | 
|---|
 | 497 | * First | 
|---|
 | 498 | * Second | 
|---|
 | 499 | * Third | 
|---|
 | 500 | '''] | 
|---|
 | 501 |  | 
|---|
 | 502 | will generate: | 
|---|
 | 503 |  | 
|---|
 | 504 | * First | 
|---|
 | 505 | * Second | 
|---|
 | 506 | * Third | 
|---|
 | 507 |  | 
|---|
 | 508 | [h3 Mixed lists] | 
|---|
 | 509 |  | 
|---|
 | 510 | Mixed lists (ordered and unordered) are supported. Example: | 
|---|
 | 511 |  | 
|---|
 | 512 | [pre''' | 
|---|
 | 513 | # One | 
|---|
 | 514 | # Two | 
|---|
 | 515 | # Three | 
|---|
 | 516 |     * Three.a | 
|---|
 | 517 |     * Three.b | 
|---|
 | 518 |     * Three.c | 
|---|
 | 519 | # Four | 
|---|
 | 520 | '''] | 
|---|
 | 521 |  | 
|---|
 | 522 | will generate: | 
|---|
 | 523 |  | 
|---|
 | 524 | # One | 
|---|
 | 525 | # Two | 
|---|
 | 526 | # Three | 
|---|
 | 527 |     * Three.a | 
|---|
 | 528 |     * Three.b | 
|---|
 | 529 |     * Three.c | 
|---|
 | 530 | # Four | 
|---|
 | 531 |  | 
|---|
 | 532 | And... | 
|---|
 | 533 |  | 
|---|
 | 534 | [pre''' | 
|---|
 | 535 | # 1 | 
|---|
 | 536 |     * 1.a | 
|---|
 | 537 |         # 1.a.1 | 
|---|
 | 538 |         # 1.a.2 | 
|---|
 | 539 |     * 1.b | 
|---|
 | 540 | # 2 | 
|---|
 | 541 |     * 2.a | 
|---|
 | 542 |     * 2.b | 
|---|
 | 543 |         # 2.b.1 | 
|---|
 | 544 |         # 2.b.2 | 
|---|
 | 545 |             * 2.b.2.a | 
|---|
 | 546 |             * 2.b.2.b | 
|---|
 | 547 | '''] | 
|---|
 | 548 |  | 
|---|
 | 549 | will generate: | 
|---|
 | 550 |  | 
|---|
 | 551 | # 1 | 
|---|
 | 552 |     * 1.a | 
|---|
 | 553 |         # 1.a.1 | 
|---|
 | 554 |         # 1.a.2 | 
|---|
 | 555 |     * 1.b | 
|---|
 | 556 | # 2 | 
|---|
 | 557 |     * 2.a | 
|---|
 | 558 |     * 2.b | 
|---|
 | 559 |         # 2.b.1 | 
|---|
 | 560 |         # 2.b.2 | 
|---|
 | 561 |             * 2.b.2.a | 
|---|
 | 562 |             * 2.b.2.b | 
|---|
 | 563 |  | 
|---|
 | 564 | [h3 Code] | 
|---|
 | 565 |  | 
|---|
 | 566 | Preformatted code starts with a space or a tab. The code will be | 
|---|
 | 567 | syntax highlighted according to the current [link syntax.source_mode source mode]: | 
|---|
 | 568 |  | 
|---|
 | 569 | [c++] | 
|---|
 | 570 |  | 
|---|
 | 571 |     #include <iostream> | 
|---|
 | 572 |  | 
|---|
 | 573 |     int main() | 
|---|
 | 574 |     { | 
|---|
 | 575 |         // Sample code | 
|---|
 | 576 |         std::cout << "Hello, World\n"; | 
|---|
 | 577 |         return 0; | 
|---|
 | 578 |     } | 
|---|
 | 579 |  | 
|---|
 | 580 | [python] | 
|---|
 | 581 |  | 
|---|
 | 582 |     import cgi | 
|---|
 | 583 |  | 
|---|
 | 584 |     def cookForHtml(text): | 
|---|
 | 585 |         '''"Cooks" the input text for HTML.''' | 
|---|
 | 586 |          | 
|---|
 | 587 |         return cgi.escape(text) | 
|---|
 | 588 |  | 
|---|
 | 589 | Macros that are already defined are expanded in source code. Example: | 
|---|
 | 590 |  | 
|---|
 | 591 | [pre''' | 
|---|
 | 592 | [def __syntax_highlight__ [@quickbook/highlight.html syntax_highlight]] | 
|---|
 | 593 | [def __quickbook__ [@index.html quickbook]] | 
|---|
 | 594 |  | 
|---|
 | 595 |     using __quickbook__::__syntax_highlight__; | 
|---|
 | 596 | '''] | 
|---|
 | 597 |  | 
|---|
 | 598 | Generates: | 
|---|
 | 599 |  | 
|---|
 | 600 | [def __syntax_highlight__ [@quickbook/highlight.html syntax_highlight]] | 
|---|
 | 601 | [def __quickbook__ [@index.html quickbook]] | 
|---|
 | 602 |  | 
|---|
 | 603 |     using __quickbook__::__syntax_highlight__; | 
|---|
 | 604 |  | 
|---|
 | 605 | [h3 Preformatted] | 
|---|
 | 606 |  | 
|---|
 | 607 | Sometimes, you don't want some preformatted text to be parsed as C++. In such | 
|---|
 | 608 | cases, use the [^[pre ... \]] markup block. | 
|---|
 | 609 |  | 
|---|
 | 610 | [pre''' | 
|---|
 | 611 | [pre | 
|---|
 | 612 |  | 
|---|
 | 613 |     Some *preformatted* text                    Some *preformatted* text | 
|---|
 | 614 |  | 
|---|
 | 615 |         Some *preformatted* text            Some *preformatted* text | 
|---|
 | 616 |  | 
|---|
 | 617 |             Some *preformatted* text    Some *preformatted* text | 
|---|
 | 618 |  | 
|---|
 | 619 | ] | 
|---|
 | 620 | '''] | 
|---|
 | 621 |  | 
|---|
 | 622 | Spaces, tabs and newlines are rendered as-is. Unlike all quickbook block level | 
|---|
 | 623 | markup, pre (and Code) are the only ones that allow multiple newlines. The | 
|---|
 | 624 | markup above will generate: | 
|---|
 | 625 |  | 
|---|
 | 626 | [pre | 
|---|
 | 627 |  | 
|---|
 | 628 | Some *preformatted* text                    Some *preformatted* text | 
|---|
 | 629 |  | 
|---|
 | 630 |     Some *preformatted* text            Some *preformatted* text | 
|---|
 | 631 |  | 
|---|
 | 632 |         Some *preformatted* text    Some *preformatted* text | 
|---|
 | 633 |  | 
|---|
 | 634 | ] | 
|---|
 | 635 |  | 
|---|
 | 636 | Notice that unlike Code, phrase markup such as font style is still permitted | 
|---|
 | 637 | inside =pre= blocks. | 
|---|
 | 638 |  | 
|---|
 | 639 | [h3 Blockquote] | 
|---|
 | 640 |  | 
|---|
 | 641 | [pre | 
|---|
 | 642 | '''[:sometext...]''' | 
|---|
 | 643 | ] | 
|---|
 | 644 |  | 
|---|
 | 645 | [:Indents the paragraph. This applies to one paragraph only.] | 
|---|
 | 646 |  | 
|---|
 | 647 | [h3 Headings] | 
|---|
 | 648 |  | 
|---|
 | 649 | [pre''' | 
|---|
 | 650 | [h1 Heading 1] | 
|---|
 | 651 | [h2 Heading 2] | 
|---|
 | 652 | [h3 Heading 3] | 
|---|
 | 653 | [h4 Heading 4] | 
|---|
 | 654 | [h5 Heading 5] | 
|---|
 | 655 | [h6 Heading 6] | 
|---|
 | 656 | '''] | 
|---|
 | 657 |  | 
|---|
 | 658 | [h1 Heading 1] | 
|---|
 | 659 | [h2 Heading 2] | 
|---|
 | 660 | [h3 Heading 3] | 
|---|
 | 661 | [h4 Heading 4] | 
|---|
 | 662 | [h5 Heading 5] | 
|---|
 | 663 | [h6 Heading 6] | 
|---|
 | 664 |  | 
|---|
 | 665 | Headings 1-3 [h1 h2 and h3] will automatically have anchors with normalized | 
|---|
 | 666 | names with [^name="section_id.normalized_header_text"] (i.e. valid characters are | 
|---|
 | 667 | =a-z=, =A-Z=, =0-9= and =_=. All non-valid characters are converted to underscore | 
|---|
 | 668 | and all upper-case are converted to lower-case. For example: Heading | 
|---|
 | 669 | 1 in section Section 2 will be normalized to [^section_2.heading_1]). You can use: | 
|---|
 | 670 |  | 
|---|
 | 671 | [pre''' | 
|---|
 | 672 | [link section_id.normalized_header_text The link text] | 
|---|
 | 673 | '''] | 
|---|
 | 674 |  | 
|---|
 | 675 | to link to them. See [link syntax.anchor_links Anchor links] and | 
|---|
 | 676 | [link syntax.section Section] for more info. | 
|---|
 | 677 |  | 
|---|
 | 678 | [h3 Macros] | 
|---|
 | 679 |  | 
|---|
 | 680 | [pre''' | 
|---|
 | 681 | [def macro_identifier some text] | 
|---|
 | 682 | '''] | 
|---|
 | 683 |  | 
|---|
 | 684 | When a macro is defined, the identifier replaces the text anywhere in the file, | 
|---|
 | 685 | in paragraphs, in markups, etc. macro_identifier is a string of non- white space | 
|---|
 | 686 | characters except '\]' while the replacement text can be any phrase (even | 
|---|
 | 687 | marked up). Example: | 
|---|
 | 688 |  | 
|---|
 | 689 | [pre''' | 
|---|
 | 690 | [def sf_logo [$http://sourceforge.net/sflogo.php?group_id=28447&type=1]] | 
|---|
 | 691 | sf_logo | 
|---|
 | 692 | '''] | 
|---|
 | 693 |  | 
|---|
 | 694 | Now everywhere the sf_logo is placed, the picture will be inlined. | 
|---|
 | 695 |  | 
|---|
 | 696 | [def sf_logo [$http://sourceforge.net/sflogo.php?group_id=28447&type=1]] | 
|---|
 | 697 | sf_logo | 
|---|
 | 698 |  | 
|---|
 | 699 | [blurb __tip__ It's a good idea to use macro identifiers that are distinguishable. | 
|---|
 | 700 | For instance, in this document, macro identifiers have two leading and trailing | 
|---|
 | 701 | underscores (e.g. [^'''__spirit__''']). The reason is to avoid unwanted macro replacement.] | 
|---|
 | 702 |  | 
|---|
 | 703 | Links (URLS) and images are good candidates for macros. *1*) They tend to | 
|---|
 | 704 | change a lot. It is a good idea to place all links and images in one place near the top | 
|---|
 | 705 | to make it easy to make changes. *2*) The syntax is not pretty. It's easier to read and | 
|---|
 | 706 | write, e.g. [^'''__spirit__'''] than [^'''[@http://spirit.sourceforge.net Spirit]''']. | 
|---|
 | 707 |  | 
|---|
 | 708 | Some more examples: | 
|---|
 | 709 |  | 
|---|
 | 710 | [pre''' | 
|---|
 | 711 | [def :-)            [$theme/smiley.png]] | 
|---|
 | 712 | [def __spirit__     [@http://spirit.sourceforge.net Spirit]] | 
|---|
 | 713 | '''] | 
|---|
 | 714 |  | 
|---|
 | 715 | (See [link syntax.images__terminal_ Images] | 
|---|
 | 716 | and [link syntax.links Links]) | 
|---|
 | 717 |  | 
|---|
 | 718 | Invoking these macros: | 
|---|
 | 719 |  | 
|---|
 | 720 | [pre''' | 
|---|
 | 721 | Hi __spirit__  :-) | 
|---|
 | 722 | '''] | 
|---|
 | 723 |  | 
|---|
 | 724 | will generate this: | 
|---|
 | 725 |  | 
|---|
 | 726 | Hi __spirit__ :-) | 
|---|
 | 727 |  | 
|---|
 | 728 | [h3 Predefined Macros] | 
|---|
 | 729 |  | 
|---|
 | 730 | Quickbook has some predefined macros that you can already use. | 
|---|
 | 731 |  | 
|---|
 | 732 | [table Predefined Macros | 
|---|
 | 733 |     [[Macro]                [Meaning]                       [Example]] | 
|---|
 | 734 |     [['''__DATE__''']       [Today's date]                  [__DATE__]] | 
|---|
 | 735 |     [['''__TIME__''']       [The current time]              [__TIME__]] | 
|---|
 | 736 |     [['''__FILENAME__''']   [Quickbook source filename]     [__FILENAME__]] | 
|---|
 | 737 | ] | 
|---|
 | 738 |  | 
|---|
 | 739 | [h3 Blurbs] | 
|---|
 | 740 |  | 
|---|
 | 741 | [pre''' | 
|---|
 | 742 | [blurb :-) [*An eye catching advertisement or note...]\n\n | 
|---|
 | 743 |     __spirit__ is an object-oriented recursive-descent parser generator framework | 
|---|
 | 744 |     implemented using template meta-programming techniques. Expression templates | 
|---|
 | 745 |     allow us to approximate the syntax of Extended Backus-Normal Form (EBNF) | 
|---|
 | 746 |     completely in C++. | 
|---|
 | 747 | ] | 
|---|
 | 748 | '''] | 
|---|
 | 749 |  | 
|---|
 | 750 | will generate this: | 
|---|
 | 751 |  | 
|---|
 | 752 | [blurb :-) [*An eye catching advertisement or note...]\n\n | 
|---|
 | 753 |     __spirit__ is an object- oriented recursive-descent parser generator | 
|---|
 | 754 |     framework implemented using template meta-programming techniques. Expression | 
|---|
 | 755 |     templates allow us to approximate the syntax of Extended Backus- Normal Form | 
|---|
 | 756 |     (EBNF) completely in C++. | 
|---|
 | 757 | ] | 
|---|
 | 758 |  | 
|---|
 | 759 | [h3 Tables] | 
|---|
 | 760 |  | 
|---|
 | 761 | [pre''' | 
|---|
 | 762 | [table A Simple Table | 
|---|
 | 763 |     [[Heading 1] [Heading 2] [Heading 3]] | 
|---|
 | 764 |     [[R0-C0]     [R0-C1]     [R0-C2]] | 
|---|
 | 765 |     [[R1-C0]     [R1-C1]     [R1-C2]] | 
|---|
 | 766 |     [[R2-C0]     [R2-C1]     [R2-C2]] | 
|---|
 | 767 | ] | 
|---|
 | 768 | '''] | 
|---|
 | 769 |  | 
|---|
 | 770 | will generate: | 
|---|
 | 771 |  | 
|---|
 | 772 | [table A Simple Table | 
|---|
 | 773 |     [[Heading 1] [Heading 2] [Heading 3]] | 
|---|
 | 774 |     [[R0-C0]     [R0-C1]     [R0-C2]] | 
|---|
 | 775 |     [[R2-C0]     [R2-C1]     [R2-C2]] | 
|---|
 | 776 |     [[R3-C0]     [R3-C1]     [R3-C2]] | 
|---|
 | 777 | ] | 
|---|
 | 778 |  | 
|---|
 | 779 | The first row of the table is automatically treated as the table header; that is, | 
|---|
 | 780 | it is wrapped in [^<thead>...</thead>] XML tags. Note that unlike the original QuickDoc, | 
|---|
 | 781 | the columns are nested in [ cells... ]. The syntax is free-format and allows big | 
|---|
 | 782 | cells to be formatted nicely. Example: | 
|---|
 | 783 |  | 
|---|
 | 784 | [pre''' | 
|---|
 | 785 | [table Table with fat cells | 
|---|
 | 786 |     [[Heading 1] [Heading 2]] | 
|---|
 | 787 |     [ | 
|---|
 | 788 |         [Row 0, Col 0: a small cell] | 
|---|
 | 789 |         [ | 
|---|
 | 790 |             Row 0, Col 1: | 
|---|
 | 791 |             A very big cell...A very big cell...A very big cell... | 
|---|
 | 792 |             A very big cell...A very big cell...A very big cell... | 
|---|
 | 793 |             A very big cell...A very big cell...A very big cell... | 
|---|
 | 794 |         ] | 
|---|
 | 795 |     ] | 
|---|
 | 796 |     [ | 
|---|
 | 797 |         [Row 1, Col 0: a small cell] | 
|---|
 | 798 |         [Row 1, Col 1: a small cell] | 
|---|
 | 799 |     ] | 
|---|
 | 800 | ] | 
|---|
 | 801 | '''] | 
|---|
 | 802 |  | 
|---|
 | 803 | and thus: | 
|---|
 | 804 |  | 
|---|
 | 805 | [table Table with fat cells | 
|---|
 | 806 |     [[Heading 1] [Heading 2]] | 
|---|
 | 807 |     [ | 
|---|
 | 808 |         [Row 0, Col 0: a small cell] | 
|---|
 | 809 |         [ | 
|---|
 | 810 |             Row 0, Col 1: | 
|---|
 | 811 |             A very big cell...A very big cell...A very big cell... | 
|---|
 | 812 |             A very big cell...A very big cell...A very big cell... | 
|---|
 | 813 |             A very big cell...A very big cell...A very big cell... | 
|---|
 | 814 |         ] | 
|---|
 | 815 |     ] | 
|---|
 | 816 |     [ | 
|---|
 | 817 |         [Row 1, Col 0: a small cell] | 
|---|
 | 818 |         [Row 1, Col 1: a small cell] | 
|---|
 | 819 |     ] | 
|---|
 | 820 | ] | 
|---|
 | 821 |  | 
|---|
 | 822 | [h3 Variable Lists] | 
|---|
 | 823 |  | 
|---|
 | 824 | [pre''' | 
|---|
 | 825 | [variablelist A Variable List | 
|---|
 | 826 |     [[term 1] [The definition of term 1]] | 
|---|
 | 827 |     [[term 2] [The definition of term 2]] | 
|---|
 | 828 |     [[term 3] [The definition of term 3]] | 
|---|
 | 829 | ] | 
|---|
 | 830 | '''] | 
|---|
 | 831 |  | 
|---|
 | 832 | will generate: | 
|---|
 | 833 |  | 
|---|
 | 834 | [variablelist A Variable List | 
|---|
 | 835 |     [[term 1] [The definition of term 1]] | 
|---|
 | 836 |     [[term 2] [The definition of term 2]] | 
|---|
 | 837 |     [[term 3] [The definition of term 3]] | 
|---|
 | 838 | ] | 
|---|
 | 839 |  | 
|---|
 | 840 | The rules for variable lists are the same as for tables, except that | 
|---|
 | 841 | only 2 "columns" are allowed. The first column contains the terms, and | 
|---|
 | 842 | the second column contains the definitions. Those familiar with HTML | 
|---|
 | 843 | will recognize this as a "definition list". | 
|---|
 | 844 |  | 
|---|
 | 845 | [endsect] | 
|---|
 | 846 | [section:ref Quick Reference] | 
|---|
 | 847 |  | 
|---|
 | 848 | [table Syntax Compendium | 
|---|
 | 849 |     [[To do this...]        [Use this...]] | 
|---|
 | 850 |     [[comment]              [[^'''[/ some comment]''']]] | 
|---|
 | 851 |     [[['italics]]           [[^'''['italics] or /italics/''']]] | 
|---|
 | 852 |     [[[*bold]]              [[^'''[*bold] or *bold*''']]] | 
|---|
 | 853 |     [[[_underline]]         [[^'''[_underline] or _underline_''']]] | 
|---|
 | 854 |     [[[^teletype]]          [[^'''[^teletype] or =teletype=''']]] | 
|---|
 | 855 |     [[source mode]          [[^\[c++\]] or [^\[python\]]]] | 
|---|
 | 856 |     [[inline code]          [[^'''`int main();`''']]] | 
|---|
 | 857 |     [[line break]           [[^'''[br]''']]] | 
|---|
 | 858 |     [[line break]           [[^'''\n''']]] | 
|---|
 | 859 |     [[anchor]               [[^'''[#anchor]''']]] | 
|---|
 | 860 |     [[link]                 [[^'''[@http://www.boost.org Boost]''']]] | 
|---|
 | 861 |     [[anchor link]          [[^'''[link section.anchor Link text]''']]] | 
|---|
 | 862 |     [[refentry link]        [[^'''[link xml.refentry Link text]''']]] | 
|---|
 | 863 |     [[function link]        [[^'''[funcref fully::qualified::function_name Link text]''']]] | 
|---|
 | 864 |     [[class link]           [[^'''[classref fully::qualified::class_name Link text]''']]] | 
|---|
 | 865 |     [[member link]          [[^'''[memberref fully::qualified::member_name Link text]''']]] | 
|---|
 | 866 |     [[enum link]            [[^'''[enumref fully::qualified::enum_name Link text]''']]] | 
|---|
 | 867 |     [[header link]          [[^'''[headerref path/to/header.hpp Link text]''']]] | 
|---|
 | 868 |     [[escape]               [[^\'\'\'escaped text (no processing/formatting)\'\'\']]] | 
|---|
 | 869 |     [[single char escape]   [[^\\c]]] | 
|---|
 | 870 |     [[images]               [[^'''[$image.jpg]''']]] | 
|---|
 | 871 |     [[begin section]        [[^'''[section The Section Title]''']]] | 
|---|
 | 872 |     [[end section]          [[^'''[endsect]''']]] | 
|---|
 | 873 |     [[paragraph]            [No markup. Paragraphs start left-flushed and are terminated by two or more newlines.]] | 
|---|
 | 874 |     [[ordered list]         [[^# one\n# two\n# three\n]]] | 
|---|
 | 875 |     [[unordered list]       [[^\* one\n\* two\n\* three\n]]] | 
|---|
 | 876 |     [[code]                 [No markup. Preformatted code starts with a space or a tab.]] | 
|---|
 | 877 |     [[preformatted]         [[^'''[pre preformatted]''']]] | 
|---|
 | 878 |     [[block quote]          [[^'''[:sometext...]''']]] | 
|---|
 | 879 |     [[heading 1]            [[^'''[h1 Heading 1]''']]] | 
|---|
 | 880 |     [[heading 2]            [[^'''[h2 Heading 2]''']]] | 
|---|
 | 881 |     [[heading 3]            [[^'''[h3 Heading 3]''']]] | 
|---|
 | 882 |     [[heading 4]            [[^'''[h4 Heading 4]''']]] | 
|---|
 | 883 |     [[heading 5]            [[^'''[h5 Heading 5]''']]] | 
|---|
 | 884 |     [[heading 6]            [[^'''[h6 Heading 6]''']]] | 
|---|
 | 885 |     [[macro]                [[^'''[def macro_identifier some text]''']]] | 
|---|
 | 886 |     [[blurb]                [[^'''[blurb advertisement or note...]''']]] | 
|---|
 | 887 |     [[table]                [[^[table Title\n \[\[a\]\[b\]\[c\]\]\n    \[\[a\]\[b\]\[c\]\]\n\]]]] | 
|---|
 | 888 |     [[variablelist]         [[^[variablelist Title\n \[\[a\]\[b\]\]\n    \[\[a\]\[b\]\]\n\]]]] | 
|---|
 | 889 | ] | 
|---|
 | 890 |  | 
|---|
 | 891 | [endsect] | 
|---|
 | 892 | [section:docinfo Library Document Grammar] | 
|---|
 | 893 |  | 
|---|
 | 894 | [c++] | 
|---|
 | 895 |  | 
|---|
 | 896 |     doc_info = | 
|---|
 | 897 |             space | 
|---|
 | 898 |         >>  '[' | 
|---|
 | 899 |         >>  (   str_p("book") | 
|---|
 | 900 |             |   "article" | 
|---|
 | 901 |             |   "library" | 
|---|
 | 902 |             |   "chapter" | 
|---|
 | 903 |             |   "part" | 
|---|
 | 904 |             ) | 
|---|
 | 905 |         >> hard_space | 
|---|
 | 906 |         >>  (  *(anychar_p - | 
|---|
 | 907 |                 (ch_p('[') | ']' | eol_p) | 
|---|
 | 908 |                 ) | 
|---|
 | 909 |             ) | 
|---|
 | 910 |         >> *( doc_version | 
|---|
 | 911 |             | doc_id | 
|---|
 | 912 |             | doc_dirname | 
|---|
 | 913 |             | doc_copyright | 
|---|
 | 914 |             | doc_purpose | 
|---|
 | 915 |             | doc_category | 
|---|
 | 916 |             | doc_authors | 
|---|
 | 917 |             | doc_license | 
|---|
 | 918 |             | doc_last_revision | 
|---|
 | 919 |             ) | 
|---|
 | 920 |         >> ']' >> +eol_p | 
|---|
 | 921 |         ; | 
|---|
 | 922 |  | 
|---|
 | 923 |     doc_version = | 
|---|
 | 924 |             space | 
|---|
 | 925 |         >> "[version" >> hard_space | 
|---|
 | 926 |         >> (*(anychar_p - ']')) | 
|---|
 | 927 |         >> ']' >> +eol_p | 
|---|
 | 928 |         ; | 
|---|
 | 929 |  | 
|---|
 | 930 |     doc_id = | 
|---|
 | 931 |             space | 
|---|
 | 932 |         >> "[id" >> hard_space | 
|---|
 | 933 |         >> (*(anychar_p - ']')) | 
|---|
 | 934 |         >> ']' >> +eol_p | 
|---|
 | 935 |         ; | 
|---|
 | 936 |  | 
|---|
 | 937 |     doc_dirname = | 
|---|
 | 938 |             space | 
|---|
 | 939 |         >> "[dirname" >> hard_space | 
|---|
 | 940 |         >> (*(anychar_p - ']')) | 
|---|
 | 941 |         >> ']' >> +eol_p | 
|---|
 | 942 |         ; | 
|---|
 | 943 |  | 
|---|
 | 944 |     doc_copyright = | 
|---|
 | 945 |             space | 
|---|
 | 946 |         >> "[copyright" >> hard_space | 
|---|
 | 947 |         >> +( repeat_p(4)[digit_p] | 
|---|
 | 948 |               >> space | 
|---|
 | 949 |             ) | 
|---|
 | 950 |         >> space | 
|---|
 | 951 |         >> (*(anychar_p - ']')) | 
|---|
 | 952 |         >> ']' >> +eol_p | 
|---|
 | 953 |         ; | 
|---|
 | 954 |  | 
|---|
 | 955 |     doc_purpose = | 
|---|
 | 956 |             space | 
|---|
 | 957 |         >> "[purpose" >> hard_space | 
|---|
 | 958 |         >> (*(anychar_p - ']')) | 
|---|
 | 959 |         >> ']' >> +eol_p | 
|---|
 | 960 |         ; | 
|---|
 | 961 |  | 
|---|
 | 962 |     doc_category = | 
|---|
 | 963 |             space | 
|---|
 | 964 |         >> "[category" >> hard_space | 
|---|
 | 965 |         >> (*(anychar_p - ']')) | 
|---|
 | 966 |         >> ']' >> +eol_p | 
|---|
 | 967 |         ; | 
|---|
 | 968 |  | 
|---|
 | 969 |     doc_author = | 
|---|
 | 970 |             space | 
|---|
 | 971 |         >>  '[' >> space | 
|---|
 | 972 |         >>  (*(anychar_p - ',')) | 
|---|
 | 973 |         >>  ',' >> space | 
|---|
 | 974 |         >>  (*(anychar_p - ']')) | 
|---|
 | 975 |         >>  ']' | 
|---|
 | 976 |         ; | 
|---|
 | 977 |  | 
|---|
 | 978 |     doc_authors = | 
|---|
 | 979 |             space | 
|---|
 | 980 |         >> "[authors" >> hard_space | 
|---|
 | 981 |         >> doc_author | 
|---|
 | 982 |         >> *(   ',' | 
|---|
 | 983 |                 >>  doc_author | 
|---|
 | 984 |             ) | 
|---|
 | 985 |         >> ']' >> +eol_p | 
|---|
 | 986 |         ; | 
|---|
 | 987 |  | 
|---|
 | 988 |     doc_license = | 
|---|
 | 989 |             space | 
|---|
 | 990 |         >> "[license" >> hard_space | 
|---|
 | 991 |         >> (*(anychar_p - ']')) | 
|---|
 | 992 |         >> ']' >> +eol_p | 
|---|
 | 993 |         ; | 
|---|
 | 994 |  | 
|---|
 | 995 |     doc_last_revision = | 
|---|
 | 996 |             space | 
|---|
 | 997 |         >> "[last-revision" >> hard_space | 
|---|
 | 998 |         >> (*(anychar_p - ']')) | 
|---|
 | 999 |         >> ']' >> +eol_p | 
|---|
 | 1000 |         ; | 
|---|
 | 1001 |  | 
|---|
 | 1002 |     doc_source_mode = | 
|---|
 | 1003 |         space | 
|---|
 | 1004 |         >> "[source-mode" >> hard_space | 
|---|
 | 1005 |         >> ( | 
|---|
 | 1006 |               str_p("c++")  | 
|---|
 | 1007 |            |  "python" | 
|---|
 | 1008 |            ) | 
|---|
 | 1009 |         >> space >> ']' >> +eol_p | 
|---|
 | 1010 |         ; | 
|---|
 | 1011 |  | 
|---|
 | 1012 |     comment = | 
|---|
 | 1013 |         "[/" >> *(anychar_p - ']') >> ']' | 
|---|
 | 1014 |         ; | 
|---|
 | 1015 |  | 
|---|
 | 1016 |     space = | 
|---|
 | 1017 |         *(space_p | comment) | 
|---|
 | 1018 |         ; | 
|---|
 | 1019 |  | 
|---|
 | 1020 |     hard_space = | 
|---|
 | 1021 |         (eps_p - (alnum_p | '_')) >> space  // must not be followed by | 
|---|
 | 1022 |         ;                                   // alpha-numeric or underscore | 
|---|
 | 1023 |  | 
|---|
 | 1024 | [endsect] | 
|---|
 | 1025 | [section:quickbook QuickBook Grammar] | 
|---|
 | 1026 |  | 
|---|
 | 1027 |     library = | 
|---|
 | 1028 |         *(space_p | comment) >> blocks >> blank | 
|---|
 | 1029 |         ; | 
|---|
 | 1030 |  | 
|---|
 | 1031 |     blocks = | 
|---|
 | 1032 |        +(   block_markup | 
|---|
 | 1033 |         |   code | 
|---|
 | 1034 |         |   list | 
|---|
 | 1035 |         |   hr | 
|---|
 | 1036 |         |   comment >> *eol | 
|---|
 | 1037 |         |   paragraph | 
|---|
 | 1038 |         |   eol | 
|---|
 | 1039 |         ) | 
|---|
 | 1040 |         ; | 
|---|
 | 1041 |  | 
|---|
 | 1042 |     space = | 
|---|
 | 1043 |         *(space_p | comment) | 
|---|
 | 1044 |         ; | 
|---|
 | 1045 |  | 
|---|
 | 1046 |     blank = | 
|---|
 | 1047 |         *(blank_p | comment) | 
|---|
 | 1048 |         ; | 
|---|
 | 1049 |  | 
|---|
 | 1050 |     eol = blank >> eol_p | 
|---|
 | 1051 |         ; | 
|---|
 | 1052 |  | 
|---|
 | 1053 |     close_bracket = | 
|---|
 | 1054 |         ']' | | 
|---|
 | 1055 |         if_p(var(is_not_preformatted)) | 
|---|
 | 1056 |         [ | 
|---|
 | 1057 |             eol_p >> eol_p                  // Make sure that we don't go | 
|---|
 | 1058 |         ]                                   // past a single block, except | 
|---|
 | 1059 |         ;                                   // when preformatted. | 
|---|
 | 1060 |  | 
|---|
 | 1061 |     hard_space = | 
|---|
 | 1062 |         (eps_p - (alnum_p | '_')) >> space  // must not be followed by | 
|---|
 | 1063 |         ;                                   // alpha-numeric or underscore | 
|---|
 | 1064 |  | 
|---|
 | 1065 |     comment = | 
|---|
 | 1066 |         "[/" >> *(anychar_p - ']') >> ']' | 
|---|
 | 1067 |         ; | 
|---|
 | 1068 |  | 
|---|
 | 1069 |     hr = | 
|---|
 | 1070 |         str_p("----") | 
|---|
 | 1071 |         >> *(anychar_p - eol) | 
|---|
 | 1072 |         >> +eol | 
|---|
 | 1073 |         ; | 
|---|
 | 1074 |  | 
|---|
 | 1075 |     block_markup = | 
|---|
 | 1076 |             '[' | 
|---|
 | 1077 |         >>  (   begin_section | 
|---|
 | 1078 |             |   end_section | 
|---|
 | 1079 |             |   headings | 
|---|
 | 1080 |             |   blurb | 
|---|
 | 1081 |             |   blockquote | 
|---|
 | 1082 |             |   preformatted | 
|---|
 | 1083 |             |   def_macro | 
|---|
 | 1084 |             |   table | 
|---|
 | 1085 |             |   variablelist | 
|---|
 | 1086 |             |   xinclude | 
|---|
 | 1087 |             ) | 
|---|
 | 1088 |         >>  (   (']' >> +eol) | 
|---|
 | 1089 |             |   eps_p | 
|---|
 | 1090 |             ) | 
|---|
 | 1091 |         ; | 
|---|
 | 1092 |  | 
|---|
 | 1093 |     begin_section = | 
|---|
 | 1094 |            "section" | 
|---|
 | 1095 |         >> hard_space | 
|---|
 | 1096 |         >>  (':' >> (*(alnum_p | '_')) | 
|---|
 | 1097 |             | eps_p | 
|---|
 | 1098 |             ) | 
|---|
 | 1099 |         >> (*(anychar_p - | 
|---|
 | 1100 |                 close_bracket)) | 
|---|
 | 1101 |         ; | 
|---|
 | 1102 |  | 
|---|
 | 1103 |     end_section = | 
|---|
 | 1104 |         str_p("endsect") | 
|---|
 | 1105 |         ; | 
|---|
 | 1106 |  | 
|---|
 | 1107 |     headings = | 
|---|
 | 1108 |         h1 | h2 | h3 | h4 | h5 | h6 | 
|---|
 | 1109 |         ; | 
|---|
 | 1110 |  | 
|---|
 | 1111 |     h1 = "h1" >> hard_space >> phrase | 
|---|
 | 1112 |     h2 = "h2" >> hard_space >> phrase | 
|---|
 | 1113 |     h3 = "h3" >> hard_space >> phrase | 
|---|
 | 1114 |     h4 = "h4" >> hard_space >> phrase | 
|---|
 | 1115 |     h5 = "h5" >> hard_space >> phrase | 
|---|
 | 1116 |     h6 = "h6" >> hard_space >> phrase | 
|---|
 | 1117 |  | 
|---|
 | 1118 |     blurb = | 
|---|
 | 1119 |         "blurb" >> hard_space | 
|---|
 | 1120 |         >> phrase | 
|---|
 | 1121 |         ; | 
|---|
 | 1122 |  | 
|---|
 | 1123 |     blockquote = | 
|---|
 | 1124 |         ':' >> blank >> | 
|---|
 | 1125 |         phrase | 
|---|
 | 1126 |         ; | 
|---|
 | 1127 |  | 
|---|
 | 1128 |     preformatted = | 
|---|
 | 1129 |         "pre" >> hard_space | 
|---|
 | 1130 |         >> !eol >> phrase | 
|---|
 | 1131 |         >> eps_p | 
|---|
 | 1132 |         ; | 
|---|
 | 1133 |  | 
|---|
 | 1134 |     def_macro = | 
|---|
 | 1135 |         "def" >> hard_space | 
|---|
 | 1136 |         >> identifier | 
|---|
 | 1137 |         >> blank >> phrase | 
|---|
 | 1138 |         ; | 
|---|
 | 1139 |  | 
|---|
 | 1140 |     table = | 
|---|
 | 1141 |         "table" >> hard_space | 
|---|
 | 1142 |         >>  (*(anychar_p - eol)) | 
|---|
 | 1143 |         >>  +eol | 
|---|
 | 1144 |         >>  *table_row | 
|---|
 | 1145 |         >>  eps_p | 
|---|
 | 1146 |         ; | 
|---|
 | 1147 |  | 
|---|
 | 1148 |     table_row = | 
|---|
 | 1149 |         space | 
|---|
 | 1150 |         >>  ch_p('[') | 
|---|
 | 1151 |         >> | 
|---|
 | 1152 |         ( | 
|---|
 | 1153 |             ( | 
|---|
 | 1154 |                 *table_cell | 
|---|
 | 1155 |                 >>  ch_p(']') | 
|---|
 | 1156 |                 >>  space | 
|---|
 | 1157 |             ) | 
|---|
 | 1158 |             | eps_p | 
|---|
 | 1159 |         ) | 
|---|
 | 1160 |         ; | 
|---|
 | 1161 |  | 
|---|
 | 1162 |     table_cell = | 
|---|
 | 1163 |         space | 
|---|
 | 1164 |         >>  ch_p('[') | 
|---|
 | 1165 |         >> | 
|---|
 | 1166 |         ( | 
|---|
 | 1167 |             ( | 
|---|
 | 1168 |                 phrase | 
|---|
 | 1169 |                 >>  ch_p(']') | 
|---|
 | 1170 |                 >>  space | 
|---|
 | 1171 |             ) | 
|---|
 | 1172 |             | eps_p | 
|---|
 | 1173 |         ) | 
|---|
 | 1174 |         ; | 
|---|
 | 1175 |  | 
|---|
 | 1176 |     variablelist = | 
|---|
 | 1177 |         "variablelist" >> hard_space | 
|---|
 | 1178 |         >>  (*(anychar_p - eol)) | 
|---|
 | 1179 |         >>  +eol | 
|---|
 | 1180 |         >>  *varlistentry | 
|---|
 | 1181 |         >>  eps_p | 
|---|
 | 1182 |         ; | 
|---|
 | 1183 |  | 
|---|
 | 1184 |     varlistentry = | 
|---|
 | 1185 |         space | 
|---|
 | 1186 |         >>  ch_p('[') | 
|---|
 | 1187 |         >> | 
|---|
 | 1188 |         ( | 
|---|
 | 1189 |             ( | 
|---|
 | 1190 |                 varlistterm | 
|---|
 | 1191 |                 >> +varlistitem | 
|---|
 | 1192 |                 >>  ch_p(']') | 
|---|
 | 1193 |                 >>  space | 
|---|
 | 1194 |             ) | 
|---|
 | 1195 |             | eps_p | 
|---|
 | 1196 |         ) | 
|---|
 | 1197 |         ; | 
|---|
 | 1198 |  | 
|---|
 | 1199 |     varlistterm = | 
|---|
 | 1200 |         space | 
|---|
 | 1201 |         >>  ch_p('[') | 
|---|
 | 1202 |         >> | 
|---|
 | 1203 |         ( | 
|---|
 | 1204 |             ( | 
|---|
 | 1205 |                 phrase | 
|---|
 | 1206 |                 >>  ch_p(']') | 
|---|
 | 1207 |                 >>  space | 
|---|
 | 1208 |             ) | 
|---|
 | 1209 |             | eps_p | 
|---|
 | 1210 |         ) | 
|---|
 | 1211 |         ; | 
|---|
 | 1212 |  | 
|---|
 | 1213 |     varlistitem = | 
|---|
 | 1214 |         space | 
|---|
 | 1215 |         >>  ch_p('[') | 
|---|
 | 1216 |         >> | 
|---|
 | 1217 |         ( | 
|---|
 | 1218 |             ( | 
|---|
 | 1219 |                 phrase | 
|---|
 | 1220 |                 >>  ch_p(']') | 
|---|
 | 1221 |                 >>  space | 
|---|
 | 1222 |             ) | 
|---|
 | 1223 |             | eps_p | 
|---|
 | 1224 |         ) | 
|---|
 | 1225 |         ; | 
|---|
 | 1226 |  | 
|---|
 | 1227 |     xinclude = | 
|---|
 | 1228 |            "xinclude" | 
|---|
 | 1229 |         >> hard_space | 
|---|
 | 1230 |         >> (*(anychar_p - | 
|---|
 | 1231 |                 close_bracket)) | 
|---|
 | 1232 |         ; | 
|---|
 | 1233 |  | 
|---|
 | 1234 |     identifier = | 
|---|
 | 1235 |         *(anychar_p - (space_p | ']')) | 
|---|
 | 1236 |         ; | 
|---|
 | 1237 |  | 
|---|
 | 1238 |     source_mode = | 
|---|
 | 1239 |        ( | 
|---|
 | 1240 |            str_p("c++") | 
|---|
 | 1241 |            |   "python" | 
|---|
 | 1242 |        ) | 
|---|
 | 1243 |        ; | 
|---|
 | 1244 |                  | 
|---|
 | 1245 |     code = | 
|---|
 | 1246 |         ( | 
|---|
 | 1247 |             code_line | 
|---|
 | 1248 |             >> *(*eol >> code_line) | 
|---|
 | 1249 |         ) | 
|---|
 | 1250 |         >> +eol | 
|---|
 | 1251 |         ; | 
|---|
 | 1252 |  | 
|---|
 | 1253 |     code_line = | 
|---|
 | 1254 |         ((ch_p(' ') | '\t')) | 
|---|
 | 1255 |         >> *(anychar_p - eol) >> eol | 
|---|
 | 1256 |         ; | 
|---|
 | 1257 |  | 
|---|
 | 1258 |     list = | 
|---|
 | 1259 |         eps_p(ch_p('*') | '#') >> | 
|---|
 | 1260 |        +( | 
|---|
 | 1261 |             (*blank_p | 
|---|
 | 1262 |             >> (ch_p('*') | '#')) | 
|---|
 | 1263 |             >> *blank_p | 
|---|
 | 1264 |             >> list_item | 
|---|
 | 1265 |         ) | 
|---|
 | 1266 |         ; | 
|---|
 | 1267 |  | 
|---|
 | 1268 |     list_item = | 
|---|
 | 1269 |        *(   common | 
|---|
 | 1270 |         |   (anychar_p - | 
|---|
 | 1271 |                 (   eol_p >> *blank_p >> eps_p(ch_p('*') | '#') | 
|---|
 | 1272 |                 |   (eol >> eol) | 
|---|
 | 1273 |                 ) | 
|---|
 | 1274 |             ) | 
|---|
 | 1275 |         ) | 
|---|
 | 1276 |         >> +eol | 
|---|
 | 1277 |         ; | 
|---|
 | 1278 |  | 
|---|
 | 1279 |     common = | 
|---|
 | 1280 |             self.actions.macro | 
|---|
 | 1281 |         |   phrase_markup | 
|---|
 | 1282 |         |   inline_code | 
|---|
 | 1283 |         |   simple_format | 
|---|
 | 1284 |         |   escape | 
|---|
 | 1285 |         |   comment | 
|---|
 | 1286 |         ; | 
|---|
 | 1287 |  | 
|---|
 | 1288 |     inline_code = | 
|---|
 | 1289 |         '`' >> | 
|---|
 | 1290 |         ( | 
|---|
 | 1291 |            *(anychar_p - | 
|---|
 | 1292 |                 (   '`' | 
|---|
 | 1293 |                 |   (eol >> eol)            // Make sure that we don't go | 
|---|
 | 1294 |                 )                           // past a single block | 
|---|
 | 1295 |             ) >> eps_p('`') | 
|---|
 | 1296 |         ) | 
|---|
 | 1297 |         >>  '`' | 
|---|
 | 1298 |         ; | 
|---|
 | 1299 |  | 
|---|
 | 1300 |     simple_format = | 
|---|
 | 1301 |             simple_bold | 
|---|
 | 1302 |         |   simple_italic | 
|---|
 | 1303 |         |   simple_underline | 
|---|
 | 1304 |         |   simple_teletype | 
|---|
 | 1305 |         ; | 
|---|
 | 1306 |  | 
|---|
 | 1307 |     simple_bold = | 
|---|
 | 1308 |         '*' >> | 
|---|
 | 1309 |         ( | 
|---|
 | 1310 |             (   graph_p >>                  // graph_p must follow '*' | 
|---|
 | 1311 |                 *(anychar_p - | 
|---|
 | 1312 |                     (   eol                 // Make sure that we don't go | 
|---|
 | 1313 |                     |   (graph_p >> '*')    // past a single line | 
|---|
 | 1314 |                     ) | 
|---|
 | 1315 |                 ) >> graph_p                // graph_p must precede '*' | 
|---|
 | 1316 |                 >> eps_p('*' | 
|---|
 | 1317 |                     >> (space_p | punct_p)) // space_p or punct_p must | 
|---|
 | 1318 |             )                               // follow '*' | 
|---|
 | 1319 |         |   ( | 
|---|
 | 1320 |                 graph_p                     // A single char. e.g. *c* | 
|---|
 | 1321 |                 >> eps_p('*' | 
|---|
 | 1322 |                     >> (space_p | punct_p)) | 
|---|
 | 1323 |             ) | 
|---|
 | 1324 |         ) | 
|---|
 | 1325 |         >> '*' | 
|---|
 | 1326 |         ; | 
|---|
 | 1327 |  | 
|---|
 | 1328 |     simple_italic = | 
|---|
 | 1329 |         '/' >> | 
|---|
 | 1330 |         ( | 
|---|
 | 1331 |             (   graph_p >>                  // graph_p must follow '/' | 
|---|
 | 1332 |                 *(anychar_p - | 
|---|
 | 1333 |                     (   eol                 // Make sure that we don't go | 
|---|
 | 1334 |                     |   (graph_p >> '/')    // past a single line | 
|---|
 | 1335 |                     ) | 
|---|
 | 1336 |                 ) >> graph_p                // graph_p must precede '/' | 
|---|
 | 1337 |                 >> eps_p('/' | 
|---|
 | 1338 |                     >> (space_p | punct_p)) // space_p or punct_p must | 
|---|
 | 1339 |             )                               // follow '/' | 
|---|
 | 1340 |         |   ( | 
|---|
 | 1341 |                 graph_p                     // A single char. e.g. /c/ | 
|---|
 | 1342 |                 >> eps_p('/' | 
|---|
 | 1343 |                     >> (space_p | punct_p)) | 
|---|
 | 1344 |             ) | 
|---|
 | 1345 |         ) | 
|---|
 | 1346 |         >> '/' | 
|---|
 | 1347 |         ; | 
|---|
 | 1348 |  | 
|---|
 | 1349 |     simple_underline = | 
|---|
 | 1350 |         '_' >> | 
|---|
 | 1351 |         ( | 
|---|
 | 1352 |             (   graph_p >>                  // graph_p must follow '_' | 
|---|
 | 1353 |                 *(anychar_p - | 
|---|
 | 1354 |                     (   eol                 // Make sure that we don't go | 
|---|
 | 1355 |                     |   (graph_p >> '_')    // past a single line | 
|---|
 | 1356 |                     ) | 
|---|
 | 1357 |                 ) >> graph_p                // graph_p must precede '_' | 
|---|
 | 1358 |                 >> eps_p('_' | 
|---|
 | 1359 |                     >> (space_p | punct_p)) // space_p or punct_p must | 
|---|
 | 1360 |             )                               // follow '_' | 
|---|
 | 1361 |         |   ( | 
|---|
 | 1362 |                 graph_p                     // A single char. e.g. _c_ | 
|---|
 | 1363 |                 >> eps_p('_' | 
|---|
 | 1364 |                     >> (space_p | punct_p)) | 
|---|
 | 1365 |             ) | 
|---|
 | 1366 |         ) | 
|---|
 | 1367 |         >> '_' | 
|---|
 | 1368 |         ; | 
|---|
 | 1369 |  | 
|---|
 | 1370 |     simple_teletype = | 
|---|
 | 1371 |         '=' >> | 
|---|
 | 1372 |         ( | 
|---|
 | 1373 |             (   graph_p >>                  // graph_p must follow '=' | 
|---|
 | 1374 |                 *(anychar_p - | 
|---|
 | 1375 |                     (   eol                 // Make sure that we don't go | 
|---|
 | 1376 |                     |   (graph_p >> '=')    // past a single line | 
|---|
 | 1377 |                     ) | 
|---|
 | 1378 |                 ) >> graph_p                // graph_p must precede '=' | 
|---|
 | 1379 |                 >> eps_p('=' | 
|---|
 | 1380 |                     >> (space_p | punct_p)) // space_p or punct_p must | 
|---|
 | 1381 |             )                               // follow '=' | 
|---|
 | 1382 |         |   ( | 
|---|
 | 1383 |                 graph_p                     // A single char. e.g. =c= | 
|---|
 | 1384 |                 >> eps_p('=' | 
|---|
 | 1385 |                     >> (space_p | punct_p)) | 
|---|
 | 1386 |             ) | 
|---|
 | 1387 |         ) | 
|---|
 | 1388 |         >> '=' | 
|---|
 | 1389 |         ; | 
|---|
 | 1390 |  | 
|---|
 | 1391 |     paragraph = | 
|---|
 | 1392 |        *(   common | 
|---|
 | 1393 |         |   (anychar_p -                    // Make sure we don't go past | 
|---|
 | 1394 |                 (eol >> eol)                // a single block. | 
|---|
 | 1395 |             ) | 
|---|
 | 1396 |         ) | 
|---|
 | 1397 |         >> +eol | 
|---|
 | 1398 |         ; | 
|---|
 | 1399 |  | 
|---|
 | 1400 |     phrase = | 
|---|
 | 1401 |        *(   common | 
|---|
 | 1402 |         |   comment | 
|---|
 | 1403 |         |   (anychar_p - | 
|---|
 | 1404 |                 close_bracket) | 
|---|
 | 1405 |         ) | 
|---|
 | 1406 |         ; | 
|---|
 | 1407 |  | 
|---|
 | 1408 |     phrase_markup = | 
|---|
 | 1409 |             '[' | 
|---|
 | 1410 |         >>  (   image | 
|---|
 | 1411 |             |   url | 
|---|
 | 1412 |             |   link | 
|---|
 | 1413 |             |   anchor | 
|---|
 | 1414 |             |   source_mode | 
|---|
 | 1415 |             |   funcref | 
|---|
 | 1416 |             |   classref | 
|---|
 | 1417 |             |   memberref | 
|---|
 | 1418 |             |   enumref | 
|---|
 | 1419 |             |   headerref | 
|---|
 | 1420 |             |   bold | 
|---|
 | 1421 |             |   italic | 
|---|
 | 1422 |             |   underline | 
|---|
 | 1423 |             |   teletype | 
|---|
 | 1424 |             |   str_p("br") | 
|---|
 | 1425 |             ) | 
|---|
 | 1426 |         >>  ']' | 
|---|
 | 1427 |         ; | 
|---|
 | 1428 |  | 
|---|
 | 1429 |     escape = | 
|---|
 | 1430 |             str_p("\\n") | 
|---|
 | 1431 |         |   '\\' >> punct_p | 
|---|
 | 1432 |         |   ( | 
|---|
 | 1433 |                 "'''" >> !eol | 
|---|
 | 1434 |             >>  *(anychar_p - "'''") | 
|---|
 | 1435 |             >>  "'''" | 
|---|
 | 1436 |             ) | 
|---|
 | 1437 |         ; | 
|---|
 | 1438 |  | 
|---|
 | 1439 |     image = | 
|---|
 | 1440 |             '$' >> blank | 
|---|
 | 1441 |         >> (*(anychar_p - | 
|---|
 | 1442 |                 close_bracket)) | 
|---|
 | 1443 |         ; | 
|---|
 | 1444 |  | 
|---|
 | 1445 |     url = | 
|---|
 | 1446 |             '@' | 
|---|
 | 1447 |         >>  (*(anychar_p - | 
|---|
 | 1448 |                 (']' | hard_space))) | 
|---|
 | 1449 |         >>  (   eps_p(']') | 
|---|
 | 1450 |             |   (hard_space >> phrase) | 
|---|
 | 1451 |             ) | 
|---|
 | 1452 |         ; | 
|---|
 | 1453 |  | 
|---|
 | 1454 |     link = | 
|---|
 | 1455 |             "link" >> hard_space | 
|---|
 | 1456 |         >>  (*(anychar_p - | 
|---|
 | 1457 |                 (']' | hard_space))) | 
|---|
 | 1458 |         >>  (   eps_p(']') | 
|---|
 | 1459 |             |   (hard_space >> phrase) | 
|---|
 | 1460 |             ) | 
|---|
 | 1461 |         ; | 
|---|
 | 1462 |  | 
|---|
 | 1463 |     anchor = | 
|---|
 | 1464 |             '#' | 
|---|
 | 1465 |         >>  blank | 
|---|
 | 1466 |         >>  (   *(anychar_p - | 
|---|
 | 1467 |                     close_bracket) | 
|---|
 | 1468 |             ) | 
|---|
 | 1469 |         ; | 
|---|
 | 1470 |  | 
|---|
 | 1471 |     funcref = | 
|---|
 | 1472 |         "funcref" >> hard_space | 
|---|
 | 1473 |         >>  (*(anychar_p - | 
|---|
 | 1474 |                 (']' | hard_space))) | 
|---|
 | 1475 |         >>  (   eps_p(']') | 
|---|
 | 1476 |             |   (hard_space >> phrase) | 
|---|
 | 1477 |             ) | 
|---|
 | 1478 |         ; | 
|---|
 | 1479 |  | 
|---|
 | 1480 |     classref = | 
|---|
 | 1481 |         "classref" >> hard_space | 
|---|
 | 1482 |         >>  (*(anychar_p - | 
|---|
 | 1483 |                 (']' | hard_space))) | 
|---|
 | 1484 |         >>  (   eps_p(']') | 
|---|
 | 1485 |             |   (hard_space >> phrase) | 
|---|
 | 1486 |             ) | 
|---|
 | 1487 |         ; | 
|---|
 | 1488 |  | 
|---|
 | 1489 |     memberref = | 
|---|
 | 1490 |         "memberref" >> hard_space | 
|---|
 | 1491 |         >>  (*(anychar_p - | 
|---|
 | 1492 |                 (']' | hard_space))) | 
|---|
 | 1493 |         >>  (   eps_p(']') | 
|---|
 | 1494 |             |   (hard_space >> phrase) | 
|---|
 | 1495 |             ) | 
|---|
 | 1496 |         ; | 
|---|
 | 1497 |  | 
|---|
 | 1498 |     enumref = | 
|---|
 | 1499 |         "enumref" >> hard_space | 
|---|
 | 1500 |         >>  (*(anychar_p - | 
|---|
 | 1501 |                 (']' | hard_space))) | 
|---|
 | 1502 |         >>  (   eps_p(']') | 
|---|
 | 1503 |             |   (hard_space >> phrase) | 
|---|
 | 1504 |             ) | 
|---|
 | 1505 |         ; | 
|---|
 | 1506 |  | 
|---|
 | 1507 |     headerref = | 
|---|
 | 1508 |         "headerref" >> hard_space | 
|---|
 | 1509 |         >>  (*(anychar_p - | 
|---|
 | 1510 |                 (']' | hard_space))) | 
|---|
 | 1511 |         >>  (   eps_p(']') | 
|---|
 | 1512 |             |   (hard_space >> phrase) | 
|---|
 | 1513 |             ) | 
|---|
 | 1514 |         ; | 
|---|
 | 1515 |  | 
|---|
 | 1516 |     bold = | 
|---|
 | 1517 |             ch_p('*') | 
|---|
 | 1518 |         >>  blank >> phrase | 
|---|
 | 1519 |         ; | 
|---|
 | 1520 |  | 
|---|
 | 1521 |     italic = | 
|---|
 | 1522 |             ch_p('\'') | 
|---|
 | 1523 |         >>  blank >> phrase | 
|---|
 | 1524 |         ; | 
|---|
 | 1525 |  | 
|---|
 | 1526 |     underline = | 
|---|
 | 1527 |             ch_p('_') | 
|---|
 | 1528 |         >>  blank >> phrase | 
|---|
 | 1529 |         ; | 
|---|
 | 1530 |  | 
|---|
 | 1531 |     teletype = | 
|---|
 | 1532 |             ch_p('^') | 
|---|
 | 1533 |         >>  blank >> phrase | 
|---|
 | 1534 |         ; | 
|---|
 | 1535 |  | 
|---|
 | 1536 | [endsect] | 
|---|
 | 1537 | [section:highlight C++ Syntax Highlighting Grammar] | 
|---|
 | 1538 |  | 
|---|
 | 1539 |     program | 
|---|
 | 1540 |         = | 
|---|
 | 1541 |         *(  macro | 
|---|
 | 1542 |         |   preprocessor | 
|---|
 | 1543 |         |   comment | 
|---|
 | 1544 |         |   keyword | 
|---|
 | 1545 |         |   identifier | 
|---|
 | 1546 |         |   special | 
|---|
 | 1547 |         |   string_ | 
|---|
 | 1548 |         |   char_ | 
|---|
 | 1549 |         |   number | 
|---|
 | 1550 |         |   space_p | 
|---|
 | 1551 |         |   anychar_p | 
|---|
 | 1552 |         ) | 
|---|
 | 1553 |         ; | 
|---|
 | 1554 |  | 
|---|
 | 1555 |     macro | 
|---|
 | 1556 |         =   *space_p >> self.macro | 
|---|
 | 1557 |         ; | 
|---|
 | 1558 |  | 
|---|
 | 1559 |     preprocessor | 
|---|
 | 1560 |         =   *space_p >> '#' >> ((alpha_p | '_') >> *(alnum_p | '_')) | 
|---|
 | 1561 |         ; | 
|---|
 | 1562 |  | 
|---|
 | 1563 |     comment | 
|---|
 | 1564 |         =   +(*space_p >> (comment_p("//") | comment_p("/*", "*/"))) | 
|---|
 | 1565 |         ; | 
|---|
 | 1566 |  | 
|---|
 | 1567 |     keyword | 
|---|
 | 1568 |         =   *space_p >> keyword_ >> (eps_p - (alnum_p | '_')) | 
|---|
 | 1569 |         ;   // make sure we recognize whole words only | 
|---|
 | 1570 |  | 
|---|
 | 1571 |     keyword_ | 
|---|
 | 1572 |         =   "and_eq", "and", "asm", "auto", "bitand", "bitor", | 
|---|
 | 1573 |             "bool", "break", "case", "catch", "char", "class", | 
|---|
 | 1574 |             "compl", "const_cast", "const", "continue", "default", | 
|---|
 | 1575 |             "delete", "do", "double", "dynamic_cast",  "else", | 
|---|
 | 1576 |             "enum", "explicit", "export", "extern", "false", | 
|---|
 | 1577 |             "float", "for", "friend", "goto", "if", "inline", | 
|---|
 | 1578 |             "int", "long", "mutable", "namespace", "new", "not_eq", | 
|---|
 | 1579 |             "not", "operator", "or_eq", "or", "private", | 
|---|
 | 1580 |             "protected", "public", "register", "reinterpret_cast", | 
|---|
 | 1581 |             "return", "short", "signed", "sizeof", "static", | 
|---|
 | 1582 |             "static_cast", "struct", "switch", "template", "this", | 
|---|
 | 1583 |             "throw", "true", "try", "typedef", "typeid", | 
|---|
 | 1584 |             "typename", "union", "unsigned", "using", "virtual", | 
|---|
 | 1585 |             "void", "volatile", "wchar_t", "while", "xor_eq", "xor" | 
|---|
 | 1586 |         ; | 
|---|
 | 1587 |  | 
|---|
 | 1588 |     special | 
|---|
 | 1589 |         =   *space_p >> +chset_p("~!%^&*()+={[}]:;,<.>?/|\\-") | 
|---|
 | 1590 |         ; | 
|---|
 | 1591 |  | 
|---|
 | 1592 |     string_ | 
|---|
 | 1593 |         =   *space_p >> !as_lower_d['l'] >> confix_p('"', *c_escape_ch_p, '"') | 
|---|
 | 1594 |         ; | 
|---|
 | 1595 |  | 
|---|
 | 1596 |     char_ | 
|---|
 | 1597 |         =   *space_p >> !as_lower_d['l'] >> confix_p('\'', *c_escape_ch_p, '\'') | 
|---|
 | 1598 |         ; | 
|---|
 | 1599 |  | 
|---|
 | 1600 |     number | 
|---|
 | 1601 |         =   *space_p >> | 
|---|
 | 1602 |             (   as_lower_d["0x"] >> hex_p | 
|---|
 | 1603 |             |   '0' >> oct_p | 
|---|
 | 1604 |             |   real_p | 
|---|
 | 1605 |             ) | 
|---|
 | 1606 |             >>  *as_lower_d[chset_p("ldfu")] | 
|---|
 | 1607 |         ; | 
|---|
 | 1608 |  | 
|---|
 | 1609 |     identifier | 
|---|
 | 1610 |         =   *space_p >> ((alpha_p | '_') >> *(alnum_p | '_')) | 
|---|
 | 1611 |         ; | 
|---|
 | 1612 |  | 
|---|
 | 1613 | [endsect] | 
|---|
 | 1614 | [section:pyhighlight Python Syntax Highlighting Grammar] | 
|---|
 | 1615 |  | 
|---|
 | 1616 | [c++] | 
|---|
 | 1617 |  | 
|---|
 | 1618 |      program | 
|---|
 | 1619 |          = | 
|---|
 | 1620 |          *(  macro | 
|---|
 | 1621 |          |   comment | 
|---|
 | 1622 |          |   keyword | 
|---|
 | 1623 |          |   identifier | 
|---|
 | 1624 |          |   special | 
|---|
 | 1625 |          |   string_ | 
|---|
 | 1626 |          |   number | 
|---|
 | 1627 |          |   space_p | 
|---|
 | 1628 |          |   anychar_p | 
|---|
 | 1629 |          ) | 
|---|
 | 1630 |          ; | 
|---|
 | 1631 |  | 
|---|
 | 1632 |     macro | 
|---|
 | 1633 |         =   *space_p >> self.macro | 
|---|
 | 1634 |         ; | 
|---|
 | 1635 |  | 
|---|
 | 1636 |      comment | 
|---|
 | 1637 |          =   +(*space_p >> comment_p("#")) | 
|---|
 | 1638 |          ; | 
|---|
 | 1639 |  | 
|---|
 | 1640 |      keyword | 
|---|
 | 1641 |          =   *space_p >> keyword_ >> (eps_p - (alnum_p | '_')) | 
|---|
 | 1642 |          ;   // make sure we recognize whole words only | 
|---|
 | 1643 |  | 
|---|
 | 1644 |      keyword_ | 
|---|
 | 1645 |          = | 
|---|
 | 1646 |          "and",       "del",       "for",       "is",        "raise",     | 
|---|
 | 1647 |          "assert",    "elif",      "from",      "lambda",    "return",    | 
|---|
 | 1648 |          "break",     "else",      "global",    "not",       "try",   | 
|---|
 | 1649 |          "class",     "except",    "if",        "or",        "while",     | 
|---|
 | 1650 |          "continue",  "exec",      "import",    "pass",      "yield",    | 
|---|
 | 1651 |          "def",       "finally",   "in",        "print", | 
|---|
 | 1652 |  | 
|---|
 | 1653 |          // Technically "as" and "None" are not yet keywords (at Python | 
|---|
 | 1654 |          // 2.4). They are destined to become keywords, and we treat them  | 
|---|
 | 1655 |          // as such for syntax highlighting purposes. | 
|---|
 | 1656 |                      | 
|---|
 | 1657 |          "as", "None" | 
|---|
 | 1658 |          ; | 
|---|
 | 1659 |  | 
|---|
 | 1660 |      special | 
|---|
 | 1661 |          =   *space_p >> +chset_p("~!%^&*()+={[}]:;,<.>/|\\-") | 
|---|
 | 1662 |          ; | 
|---|
 | 1663 |  | 
|---|
 | 1664 |      string_prefix | 
|---|
 | 1665 |          =    as_lower_d[str_p("u") >> ! str_p("r")] | 
|---|
 | 1666 |          ; | 
|---|
 | 1667 |                  | 
|---|
 | 1668 |      string_ | 
|---|
 | 1669 |          =   *space_p >> ! string_prefix >> (long_string | short_string) | 
|---|
 | 1670 |          ; | 
|---|
 | 1671 |  | 
|---|
 | 1672 |      short_string | 
|---|
 | 1673 |          =   confix_p('"', * c_escape_ch_p, '"') | | 
|---|
 | 1674 |              confix_p('\'', * c_escape_ch_p, '\'')     | 
|---|
 | 1675 |          ; | 
|---|
 | 1676 |              | 
|---|
 | 1677 |      long_string | 
|---|
 | 1678 |          =   confix_p("'''", * lex_escape_ch_p, "'''") | | 
|---|
 | 1679 |              confix_p("\"\"\"", * lex_escape_ch_p, "\"\"\"") | 
|---|
 | 1680 |          ; | 
|---|
 | 1681 |                  | 
|---|
 | 1682 |      number | 
|---|
 | 1683 |          =   *space_p >> | 
|---|
 | 1684 |              ( | 
|---|
 | 1685 |                  as_lower_d["0x"] >> hex_p | 
|---|
 | 1686 |              |   '0' >> oct_p | 
|---|
 | 1687 |              |   real_p | 
|---|
 | 1688 |              ) | 
|---|
 | 1689 |              >>  *as_lower_d[chset_p("lj")] | 
|---|
 | 1690 |          ; | 
|---|
 | 1691 |  | 
|---|
 | 1692 |      identifier | 
|---|
 | 1693 |          =   *space_p >> ((alpha_p | '_') >> *(alnum_p | '_')) | 
|---|
 | 1694 |          ; | 
|---|
 | 1695 |  | 
|---|
 | 1696 | [endsect] | 
|---|