Sign in Join
Wiki copytemporary

How To Make Lazarus Docs: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Making Documentation Files for Lazarus
22
33### Overview and XML description files
44
55Documentation files, which will eventually be incorporated into the on-line Help system, can be generated from the Unit files in the Lazarus Component Library (lcl). The FpDoc utility can generate HTML (and other, such as CHM) files using the Pascal source files (*.pp or *.pas) as input. A great deal more useful information can be incorporated if an XML description file can be used in conjunction with the source file. This description file contains the actual help text, while the source code provides the function names etc.
66
7-While it is perfectly possible to generate the XML tags by hand, using the instructions in the FpDoc manual, it is much easier to use the utility <u>makeskel</u> which is provided as part of the FpDoc suite. This utility generates an XML file with a set of empty tags for every identifier, type, procedure and function in the source file.
7+While it is perfectly possible to generate the XML tags by hand, using the instructions in the FpDoc manual, it is much easier to use the utility makeskel which is provided as part of the FpDoc suite. This utility generates an XML file with a set of empty tags for every identifier, type, procedure and function in the source file.
88
99The user can then edit this XML file, either with
1010
1111- a simple text editor
1212- an XML editor like KXMLEditor
1313- the specialized [[FPDoc Editor|FPDoc editor]] which is included with Lazarus. This tool can be used to quickly edit entries when writing code.
1414- the specialized [[Lazarus Documentation Editor]] which is included with Lazarus (you'll need to compile it and use it as an external tool). This is the most extensive tool and is quite user-friendly.
1515
1616There is a huge number of entries in these files: I suggest that only the tags describing Objects be edited, at least initially (use the Search facility to find 'object', and then enter short titles and descriptions for the components).
1717
1818### Creating output
1919
2020Having an XML description file is fine, but you probably want some more readable output. You can generate e.g. html, chm and other output (note: not all platforms support all outputs).
2121
2222#### Creating output with lazde
2323
2424The [[Lazarus Documentation Editor]] (LazDE) tool has a dialog (Menu Extra, Build) that lets you build help files as well. This tool offers GUI controls for the various files so it might be the easiest for beginners or casual users. This tool calls fpdoc to process the files.
2525
2626#### Creating output with build_lcl_docs
2727
2828The Lazarus tool build_lcl_docs in \$(lazarusdir)\docs\html allows you to combine many description files and source file and generate all kinds of output. Internally it uses fpdoc like the previous tool.
2929
3030#### Creating output with fpdoc
3131
3232Finally, you can also call fpdoc directly.
3333
3434When you have finished editing the XML file, save it and then run
3535
3636``` bash
3737fpdoc --package=lcl --input=thisunit.pp --descr=thisunit.xml
3838```
3939
4040The "lcl" indicates you're editing LCL help; if you're editing FPC help, it would probably be "fcl" (these names are determined by the developers in charge of documentation and are not apparent from other sources). The resultant HTML files will be placed in a subdirectory called 'thisunit'.
4141
4242(As mentioned, you can also output in other formats, but those are not discussed here)
4343
4444There will be a huge number of HTML files (typically about 160) - these will eventually all be used for Help files, but there is too much information, for example, to put on this WiKi site. It is helpful to filter the files, only including those that describe components.
4545
4646This can be done with:
4747
4848``` bash
4949grep -l Inheritance * > outputfile
5050```
5151
5252as only components have a description of their inheritance.
5353
5454The outputfile can then be used to drive a utility to convert HTML to text. One such application is html2text. The process has been partly automated in the following Pascal program (which is excessively simple, not particularly robust, but works):
5555
5656``` pascal
5757program convhtml;
5858{ CT Kirkpatrick, MD 20040720 }
5959{$mode objfpc}{$H+}
6060{ reads a list of filenames from listfile, and converts them in
6161turn from HTML to plain text, writing the output of all the files to outfile }
6262uses
6363 Classes, unix;
6464var
6565 listfile, outfile: text;
6666 pathname, listfname, outfname, fname: string;
6767 execstring, comstring: string;
6868begin
6969 Writeln ('Enter path for files to convert');
7070 Readln (pathname);
7171 Writeln ('Enter name of file to contain list of files for conversion');
7272 Readln (listfname);
7373 shell ('grep -l Inheritance ' + pathname + '* > ' + pathname + 'filelist.txt');
7474 Writeln ('Enter name of output file');
7575 Readln (outfname);
7676 Assign (listfile, pathname +'filelist.txt');
7777 Assign (outfile, pathname + outfname);
7878 Reset (listfile);
7979 Rewrite (outfile);
8080 while not eof (listfile) do
8181 begin
8282 readln (listfile, fname); //writeln (fname);
8383 //if fname = '' then begin readln (listfile, fname); writeln (fname) end;
8484 execstring := '/usr/bin/html2text ';
8585 comstring := '-nobs ' + fname
8686 + ' >> ' + pathname + outfname;
8787 writeln ('Executing ', execstring, comstring);
8888 shell (execstring + comstring);
8989 end;
9090end.
9191```
9292
9393---
9494*From the Free Pascal wiki, page "How To Make Lazarus Docs", as it stood on 2020-02-17 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history