edoc custom XML layout

Serge Aleynikov serge@REDACTED
Sat Jun 24 17:31:17 CEST 2006


Hi,

I am trying to figure out how to write a custom layout module for edoc 
in order to export Erlang documentation to an XML format suitable for 
including in our internal documentation site powered by the Appache's 
Forrest engine (forrest.apache.org).

As the edoc's documentation doesn't mention the guidelines for creating 
custom layouts, is there any reference or samples with some helpful info 
(other than the *.erl sources)?

I tried to call edoc:read/2, but it doesn't seem to work with 
otpsgml_layout:

23> pwd().
/opt/erlang/R11B-0/lib/erlang/lib/edoc-0.6.9/src
ok
24> edoc:read("edoc_layout.erl", [{layout, edoc_layout}]).
["<!DOCTYPE HTML PUBLIC \"",
  "-//W3C//DTD HTML 4.01 Transitional//EN",
  ...
]

25> edoc:read("edoc_layout.erl", [{layout, otpsgml_layout}]).
edoc: error in layout 'otpsgml_layout': 
{'EXIT',{badarg,[{erlang,binary_to_list,[{aname,[[82,105,99,104,97,114,100|...]]}]},{xmerl_lib,export_text,2},{xmerl_lib,export_text,2},{xmerl,apply_cb,5},{xmerl,export_content,2},{xmerl,export_content,2},{xmerl,export_content,2},{xmerl,export_content,2}]}}.
** exited: error **

Is my assumption correct that I would need to create a xxx_layout.erl 
module similar to otpsgml_layout, and then make the following call to 
generate edoc documentation using that layout:

edoc:run([], ["my_file.erl"], [{layout, xxx_layout}]).

I am only guessing because edoc:run/3 doesn't mention the {layout, 
Layout} option.

Regards,

Serge



More information about the erlang-questions mailing list