aboutsummaryrefslogtreecommitdiffstats
path: root/lib/docbuilder/src/docb_main.erl
diff options
context:
space:
mode:
authorLars Thorsen <[email protected]>2010-11-25 14:07:06 +0100
committerLars Thorsen <[email protected]>2010-12-02 08:49:26 +0100
commit85d84e5ff784fdb590ed6e4f6ca6022919fb43c8 (patch)
treef843534981d9700657779f5b059227b0830762ff /lib/docbuilder/src/docb_main.erl
parenta13deef4f2d5018cbdad51206d96cdde3e50f064 (diff)
downloadotp-85d84e5ff784fdb590ed6e4f6ca6022919fb43c8.tar.gz
otp-85d84e5ff784fdb590ed6e4f6ca6022919fb43c8.tar.bz2
otp-85d84e5ff784fdb590ed6e4f6ca6022919fb43c8.zip
Fix compatability issues with docbuilder for R11.
Diffstat (limited to 'lib/docbuilder/src/docb_main.erl')
-rw-r--r--lib/docbuilder/src/docb_main.erl29
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/docbuilder/src/docb_main.erl b/lib/docbuilder/src/docb_main.erl
index 87a1401a02..4f5f035a65 100644
--- a/lib/docbuilder/src/docb_main.erl
+++ b/lib/docbuilder/src/docb_main.erl
@@ -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),
@@ -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