diff options
author | Lukas Larsson <[email protected]> | 2012-03-09 11:15:43 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2012-03-09 11:15:43 +0100 |
commit | 91de0b23d35782b2059faa7323744138eb5545f8 (patch) | |
tree | 9199b26c971948b78ff15d87dc7bc538cf3f89cf /lib/erl_docgen | |
parent | a7714f269498e51f02c598446ef8626c380d30b1 (diff) | |
parent | 1eb67b0e35cb647b61d19eb9f58ed81cc4368576 (diff) | |
download | otp-91de0b23d35782b2059faa7323744138eb5545f8.tar.gz otp-91de0b23d35782b2059faa7323744138eb5545f8.tar.bz2 otp-91de0b23d35782b2059faa7323744138eb5545f8.zip |
Merge branch 'lukas/erl_docgen/fix_range_type/OTP-9970' into maint
* lukas/erl_docgen/fix_range_type/OTP-9970:
Add so that <img> tags will be transformed to <image>
Allow 1..2 types to be exported from edoc
Diffstat (limited to 'lib/erl_docgen')
-rw-r--r-- | lib/erl_docgen/src/docgen_edoc_xml_cb.erl | 23 |
1 files changed, 23 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 dc9bc565ee..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} @@ -975,6 +993,8 @@ t_type([E=#xmlElement{name = atom}]) -> t_atom(E); t_type([E=#xmlElement{name = integer}]) -> t_integer(E); +t_type([E=#xmlElement{name = range}]) -> + t_range(E); t_type([E=#xmlElement{name = float}]) -> t_float(E); t_type([#xmlElement{name = nil}]) -> @@ -1001,6 +1021,9 @@ t_atom(E) -> t_integer(E) -> [get_attrval(value, E)]. +t_range(E) -> + [get_attrval(value, E)]. + t_float(E) -> [get_attrval(value, E)]. |