docb_gen
Generate XML from EDoc comments in Erlang source code.
docb_gen
contains functions for generating XML
documentation source code according to the erlref
or
chapter
DTD from
EDoc comments in Erlang
source code or an overview.edoc
file, using EDoc.
Functions
module(File) -> ok | {error, Reason}
module(File, Options) -> ok | {error, Reason}
File = string()
Options = [Opt]
Opt = {def,Defs} | {includes,Dirs} | {preprocess,Bool} | {sort_functions,Bool}
Defs = [{atom(),string()}]
Dirs = [string()]
Bool = bool()
Reason = badfile | {badopt,term()} | term()
Generates XML documentation source code according to
the erlref
DTD from EDoc comments File
, using
the EDoc application.
File
is an Erlang source file, given with or without
the .erl
extension as Name.erl
or Name
.
The resulting XML file is created in the current working
directory and named Name.xml
.
Options
is a list of options, see below.
Returns ok
if successful, and an error tuple
otherwise.
users_guide(File) -> ok | {error, Reason}
users_guide(File, Options) -> ok | {error, Reason}
File -- see module/1,2
Options -- see module/1,2
Reason -- see module/1,2
Like module/1,2
but generates XML source code
according to the chapter
DTD from an
overview.edoc
or similar file.
The resulting file is named chapter.xml
.
Options
{def, [{Name,Text}]}
{includes, [Dir]}
{preprocess, true|false}
false
. See
edoc:read_source/2.{sort_functions, true|false}
true
.Limitations
The mapping from the EDoc XHTML output to valid Erlang/OTP XML
is not complete. An attempt has been made to cover the most
commonly used XHTML constructs, but there will still be cases
where XML generation fails or where the resulting XML is
inadequate. This is especially true for users_guide/1,2
.
Known limitations for some XHTML tags:
<a>
All attributes except the first href
or name
attribute are ignored.
A href
attribute means the <a>
tag
will be transformed to a <seealso>
or
<url>
tag and an attempt is made to
resolve the reference if necessary.
A name
attribute means the <a>
tag
will be transformed to a <marker>
tag.
<b>, <em>, <pre>
<center>
<font>
<h1>, <h2>, ...
<h3>
and
<h4>
tags within overview.edoc
, see
part about "chapter
DTD" below.
<sup>
<seealso marker="edoc:edoc#run/3...>
" does
not work. (But
"<seealso marker="edoc:edoc#run-3...>
" does.)
erlref DTD
chapter DTD
<h3>
(equivalent to EDoc headings "== Heading ==
") is
interpreted as start of top-level section, or if there is no
<h3>
tag, the entire document is made into
one top-level section. <h4>
(equivalent to
EDoc sub-headings ("=== Sub-heading ===
") is
interpreted as start of second-level section.
erlref
DTD.