aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_docgen
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2012-02-13 12:06:38 +0100
committerLukas Larsson <[email protected]>2012-02-14 14:59:13 +0100
commit1eb67b0e35cb647b61d19eb9f58ed81cc4368576 (patch)
tree93f45f0797cdb65005eb8311d52650b3c787cd7f /lib/erl_docgen
parent617512640c9c5196fc9a6cc2de7742c393410059 (diff)
downloadotp-1eb67b0e35cb647b61d19eb9f58ed81cc4368576.tar.gz
otp-1eb67b0e35cb647b61d19eb9f58ed81cc4368576.tar.bz2
otp-1eb67b0e35cb647b61d19eb9f58ed81cc4368576.zip
Add so that <img> tags will be transformed to <image>
Diffstat (limited to 'lib/erl_docgen')
-rw-r--r--lib/erl_docgen/src/docgen_edoc_xml_cb.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl
index 0971451b32..20daae8215 100644
--- a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl
+++ b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl
@@ -187,6 +187,7 @@ chapter_title(#xmlElement{content=Es}) -> % name = h3 | h4
%% 8) <blockquote> contents may need to be made into paragraphs
%% 9) <th> (table header) is not allowed - is replaced by
%% <td><em>...</em></td>.
+%% 10) <img src=""> is not allowed, replace with <image file="">
otp_xmlify([]) ->
[];
otp_xmlify(Es0) ->
@@ -416,6 +417,9 @@ otp_xmlify_e(#xmlElement{name=tr} = E) ->
otp_xmlify_e(#xmlElement{name=td} = E) ->
Content = otp_xmlify_e(E#xmlElement.content),
[E#xmlElement{content=Content}];
+otp_xmlify_e(#xmlElement{name=img} = E) -> % 10)
+ Content = otp_xmlify_e(E#xmlElement.content),
+ [otp_xmlify_img(E#xmlElement{ content = Content })];
otp_xmlify_e([E | Es]) ->
otp_xmlify_e(E) ++ otp_xmlify_e(Es);
otp_xmlify_e([]) ->
@@ -634,6 +638,20 @@ otp_xmlify_table([#xmlElement{name=td, content=Content}|Es]) ->
otp_xmlify_table([]) ->
[].
+%% otp_xmlify_img(E) -> Es.
+%% Transforms a <img src=""> into <image file="">
+otp_xmlify_img(E0) ->
+ Attrs = lists:map(
+ fun(#xmlAttribute{ name = src, value = Path} = A) ->
+ V = otp_xmlify_a_fileref(Path,this),
+ A#xmlAttribute{ name = file,
+ value = V };
+ (A) ->
+ A
+ end,E0#xmlElement.attributes),
+ E0#xmlElement{name = image, expanded_name = image,
+ attributes = Attrs}.
+
%%--Misc help functions used by otp_xmlify/1 et al---------------------
%% find_next(Tag, Es) -> {Es1, Es2}