| 1 | This is a Quick Reference for |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | Haddock is the POD of Haskell, it's used in the Pugs source to |
|---|
| 5 | document the Haskell code. "make haskell" generates cross-linked |
|---|
| 6 | html documentation in the ./dist/doc/html directory. |
|---|
| 7 | Haddock is also able to extract type, function and module information |
|---|
| 8 | automatically. |
|---|
| 9 | |
|---|
| 10 | Haddock's homepage is: |
|---|
| 11 | |
|---|
| 12 | http://www.haskell.org/haddock/ |
|---|
| 13 | http://cvs.haskell.org/darcs/haddock/examples/ |
|---|
| 14 | |
|---|
| 15 | An online copy of Pugs haddock output is available at: |
|---|
| 16 | |
|---|
| 17 | http://nothingmuch.woobling.org/pugs_test_status/haddock/ |
|---|
| 18 | |
|---|
| 19 | This document is intended to aid Pugs documentation and code contributors |
|---|
| 20 | who want to get started with a minimum of effort. |
|---|
| 21 | This file is just plain text to avoid requiring any kind of escaping. |
|---|
| 22 | Scan this file for "===" to see the topics covers |
|---|
| 23 | |
|---|
| 24 | POD <=> Haddock Phrase Book |
|---|
| 25 | =========================== |
|---|
| 26 | POD Haddock |
|---|
| 27 | Paragraph \n\n+ separated Paragraph also \n\n+ separated |
|---|
| 28 | E<gt>,E<sol> \>,\/ use \ to escape /, ', `, ", @, < |
|---|
| 29 | or *, - a the start of a line |
|---|
| 30 | verbatim paragraph > verbatim paragraph |
|---|
| 31 | L<Perl::Module::function> 'Haskell.Module.function' hyperlinks (or `T') |
|---|
| 32 | Strings in '' which aren't identifiers are ignored |
|---|
| 33 | L<url> <url> |
|---|
| 34 | L<Module> "Module" |
|---|
| 35 | L<Module/Section> 'Module#Section' |
|---|
| 36 | X<SectionAnchor> #SectionAnchor# a non-rendered target for '#sec' |
|---|
| 37 | C<monospaced code> @monospaced code@ |
|---|
| 38 | B<emphasis> /emphasis/ |
|---|
| 39 | =head1 -- * |
|---|
| 40 | =head2 -- ** |
|---|
| 41 | =head3 -- *** |
|---|
| 42 | =over, =back Nothing |
|---|
| 43 | =item * * or - at start of paragraph |
|---|
| 44 | =item 1. (1) or 1. at start of paragraph |
|---|
| 45 | =item name [@name@] at start of paragraph |
|---|
| 46 | |
|---|
| 47 | --| Documentation for the next thing (top level or in declarations) |
|---|
| 48 | {-| Multiline version of above -} |
|---|
| 49 | |
|---|
| 50 | --^ Documentation for the previous thing (top level or in declarations) |
|---|
| 51 | {-^ Multiline version of above -} |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | Documentation Build Process |
|---|
| 55 | =========================== |
|---|
| 56 | |
|---|
| 57 | make haddock |
|---|
| 58 | |
|---|
| 59 | This produces the cross-linked html documentation for Pugs in the |
|---|
| 60 | ./dist/doc/html directory. If any of the input .hs files is causes |
|---|
| 61 | haddock to fail then the haddock-broken make target can be used to produce |
|---|
| 62 | documentation for one file at a time. This is inferior to make haddock |
|---|
| 63 | as the identifier links aren't correctly produced. |
|---|
| 64 | |
|---|
| 65 | Internally, make haddock first filters the .hs files to remove |
|---|
| 66 | problematic constructs. The haddock program can be confused by some |
|---|
| 67 | GHC extensions and the util/munge_haddock.pl attempts to avoid this. |
|---|
| 68 | |
|---|
| 69 | Note that Haddock only builds documentation for the interface of |
|---|
| 70 | modules, so the documentation for internal methods may not appear |
|---|
| 71 | in the output. The --# ignore-exports (or {-# ignore-exports}) option |
|---|
| 72 | can appear for the module definition to override this. |
|---|
| 73 | |
|---|
| 74 | Understanding and Correcting Errors |
|---|
| 75 | =================================== |
|---|
| 76 | |
|---|
| 77 | If make haddock fails then you can use make haddock-broken to produce |
|---|
| 78 | inferior documentation. There are a few strategies available to fix |
|---|
| 79 | the file which breaks haddock. Note that the location of the error |
|---|
| 80 | messages are not always helpful, for example, a "string" pages above |
|---|
| 81 | can cause an error at the first line of code below it. |
|---|
| 82 | |
|---|
| 83 | As haddock ignore plain {- -} comments, you can just change the "{-|" |
|---|
| 84 | to test whether a particular comment block is causing the problem. |
|---|
| 85 | |
|---|
| 86 | Once the block has been found, it can be split with "-}{-" to binary |
|---|
| 87 | search for the problem. Turning a paragraph into a verbatim block |
|---|
| 88 | with s/^/> / can also isolate the trouble. Individual files can |
|---|
| 89 | be run with haddock $filename. |
|---|
| 90 | |
|---|
| 91 | Common problems: |
|---|
| 92 | - @Larry unescaped @ characters |
|---|
| 93 | - "double-quoted strings" which are not links to modules |
|---|
| 94 | - -- | ControlEnv !Env, misinterpreted commenting out (-- \| instead) |
|---|
| 95 | |
|---|
| 96 | To fix problems you can escape with \, rephrase or use a non-haddock |
|---|
| 97 | comment block. |
|---|
| 98 | |
|---|
| 99 | If the code is the source of the problem then the following #ifdefs |
|---|
| 100 | can be used to remove the code before haddock sees it. This is done |
|---|
| 101 | in munge_haddock.pl |
|---|
| 102 | |
|---|
| 103 | #ifndef HADDOCK |
|---|
| 104 | #endif HADDOCK |
|---|
| 105 | |
|---|
| 106 | Haddock Vim Syntax File |
|---|
| 107 | ================= |
|---|
| 108 | |
|---|
| 109 | Ask bsb on #perl6 if you want to take it for a spin |
|---|