Skip to content

Commit

Permalink
Fix compatability issues with docbuilder for R11.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthor committed Dec 2, 2010
1 parent a13deef commit 85d84e5
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions lib/docbuilder/src/docb_main.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,23 @@
%% Parses the source file File and transforms the result to html,
%% latex and/or man page format.
process(File, Opts) ->

File1 = File ++ ".tmpconv",
os:cmd("sed -e 's/xi:include[ \t]*href/include file/g' -e 's/xmlns:xi=\"http:\\/\\/www.w3.org\\/2001\\/XInclude\"//g' < " ++
File ++ ".xml > " ++ File1 ++ ".xml"), %LATH

SrcType = docb_util:lookup_option(src_type, Opts),

File1 =
case SrcType of
".xml" ->
FileTmp = File ++ ".tmpconv",
os:cmd("sed -e 's/xi:include[ \t]*href/include file/g' -e 's/xmlns:xi=\"http:\\/\\/www.w3.org\\/2001\\/XInclude\"//g' < " ++
File ++ ".xml > " ++ FileTmp ++ ".xml"),
FileTmp;
".sgml" ->
File
end,

case parse1(File1, Opts) of
errors ->
file:delete(File1 ++ ".xml"),
delete_tmp_file(SrcType, File1),
errors;
{ok, Tree} ->
From = element(1, Tree),
Expand All @@ -62,15 +71,21 @@ process(File, Opts) ->
Result = [transform(From, To, Opts, File, Tree)||To <- Tos],
case lists:member(transformation_error,Result) of
true ->
file:delete(File1 ++ ".xml"),
delete_tmp_file(SrcType, File1),
errors;
_ ->
file:delete(File1 ++ ".xml"),
delete_tmp_file(SrcType, File1),
ok
end

end.


delete_tmp_file(".xml", File) ->
file:delete(File ++ ".xml");
delete_tmp_file(_, _) ->
ok.

%%----------------------------------------------------------------------

%% parse(File, Opts) -> {ok, Tree} | errors
Expand Down

0 comments on commit 85d84e5

Please sign in to comment.