diff options
author | Lars Thorsen <[email protected]> | 2010-11-25 14:07:06 +0100 |
---|---|---|
committer | Lars Thorsen <[email protected]> | 2010-12-02 08:49:26 +0100 |
commit | 85d84e5ff784fdb590ed6e4f6ca6022919fb43c8 (patch) | |
tree | f843534981d9700657779f5b059227b0830762ff /lib/docbuilder/src | |
parent | a13deef4f2d5018cbdad51206d96cdde3e50f064 (diff) | |
download | otp-85d84e5ff784fdb590ed6e4f6ca6022919fb43c8.tar.gz otp-85d84e5ff784fdb590ed6e4f6ca6022919fb43c8.tar.bz2 otp-85d84e5ff784fdb590ed6e4f6ca6022919fb43c8.zip |
Fix compatability issues with docbuilder for R11.
Diffstat (limited to 'lib/docbuilder/src')
-rw-r--r-- | lib/docbuilder/src/docb_main.erl | 29 |
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 |