blob: d8bf04308b43d0ca9b52a6b23c03779134193442 [file] [log] [blame]
Mauro Carvalho Chehab1dc4bbf2016-11-17 08:32:33 -02001DocBook XML [DEPRECATED]
2========================
3
4.. attention::
5
6 This section describes the deprecated DocBook XML toolchain. Please do not
7 create new DocBook XML template files. Please consider converting existing
8 DocBook XML templates files to Sphinx/reStructuredText.
9
10Converting DocBook to Sphinx
11----------------------------
12
13Over time, we expect all of the documents under ``Documentation/DocBook`` to be
14converted to Sphinx and reStructuredText. For most DocBook XML documents, a good
15enough solution is to use the simple ``Documentation/sphinx/tmplcvt`` script,
16which uses ``pandoc`` under the hood. For example::
17
18 $ cd Documentation/sphinx
19 $ ./tmplcvt ../DocBook/in.tmpl ../out.rst
20
21Then edit the resulting rst files to fix any remaining issues, and add the
22document in the ``toctree`` in ``Documentation/index.rst``.
23
24Components of the kernel-doc system
25-----------------------------------
26
27Many places in the source tree have extractable documentation in the form of
28block comments above functions. The components of this system are:
29
30- ``scripts/kernel-doc``
31
32 This is a perl script that hunts for the block comments and can mark them up
33 directly into reStructuredText, DocBook, man, text, and HTML. (No, not
34 texinfo.)
35
36- ``Documentation/DocBook/*.tmpl``
37
38 These are XML template files, which are normal XML files with special
39 place-holders for where the extracted documentation should go.
40
41- ``scripts/docproc.c``
42
43 This is a program for converting XML template files into XML files. When a
44 file is referenced it is searched for symbols exported (EXPORT_SYMBOL), to be
45 able to distinguish between internal and external functions.
46
47 It invokes kernel-doc, giving it the list of functions that are to be
48 documented.
49
50 Additionally it is used to scan the XML template files to locate all the files
51 referenced herein. This is used to generate dependency information as used by
52 make.
53
54- ``Makefile``
55
56 The targets 'xmldocs', 'psdocs', 'pdfdocs', and 'htmldocs' are used to build
57 DocBook XML files, PostScript files, PDF files, and html files in
58 Documentation/DocBook. The older target 'sgmldocs' is equivalent to 'xmldocs'.
59
60- ``Documentation/DocBook/Makefile``
61
62 This is where C files are associated with SGML templates.
63
64How to use kernel-doc comments in DocBook XML template files
65------------------------------------------------------------
66
67DocBook XML template files (\*.tmpl) are like normal XML files, except that they
68can contain escape sequences where extracted documentation should be inserted.
69
70``!E<filename>`` is replaced by the documentation, in ``<filename>``, for
71functions that are exported using ``EXPORT_SYMBOL``: the function list is
72collected from files listed in ``Documentation/DocBook/Makefile``.
73
74``!I<filename>`` is replaced by the documentation for functions that are **not**
75exported using ``EXPORT_SYMBOL``.
76
77``!D<filename>`` is used to name additional files to search for functions
78exported using ``EXPORT_SYMBOL``.
79
80``!F<filename> <function [functions...]>`` is replaced by the documentation, in
81``<filename>``, for the functions listed.
82
83``!P<filename> <section title>`` is replaced by the contents of the ``DOC:``
84section titled ``<section title>`` from ``<filename>``. Spaces are allowed in
85``<section title>``; do not quote the ``<section title>``.
86
87``!C<filename>`` is replaced by nothing, but makes the tools check that all DOC:
88sections and documented functions, symbols, etc. are used. This makes sense to
89use when you use ``!F`` or ``!P`` only and want to verify that all documentation
90is included.