diff options
Diffstat (limited to 'lib/edoc/src/edoc_doclet.erl')
-rw-r--r-- | lib/edoc/src/edoc_doclet.erl | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/edoc/src/edoc_doclet.erl b/lib/edoc/src/edoc_doclet.erl index 385d20e9ae..d6561e10fc 100644 --- a/lib/edoc/src/edoc_doclet.erl +++ b/lib/edoc/src/edoc_doclet.erl @@ -193,7 +193,8 @@ source({M, P, Name, Path}, Dir, Suffix, Env, Set, Private, Hidden, true -> Text = edoc:layout(Doc, Options), Name1 = packages:last(M) ++ Suffix, - edoc_lib:write_file(Text, Dir, Name1, P), + Encoding = [{encoding,encoding(Doc)}], + edoc_lib:write_file(Text, Dir, Name1, P, Encoding), {sets:add_element(Module, Set), Error}; false -> {Set, Error} @@ -359,14 +360,19 @@ xhtml_1(Title, CSS, Body) -> overview(Dir, Title, Env, Opts) -> File = proplists:get_value(overview, Opts, filename:join(Dir, ?OVERVIEW_FILE)), + Encoding = edoc_lib:read_encoding(File, [{in_comment_only, false}]), Tags = read_file(File, overview, Env, Opts), - Data = edoc_data:overview(Title, Tags, Env, Opts), + Data0 = edoc_data:overview(Title, Tags, Env, Opts), + EncodingAttribute = #xmlAttribute{name = encoding, + value = atom_to_list(Encoding)}, + #xmlElement{attributes = As} = Data0, + Data = Data0#xmlElement{attributes = [EncodingAttribute | As]}, F = fun (M) -> M:overview(Data, Opts) end, Text = edoc_lib:run_layout(F, Opts), - edoc_lib:write_file(Text, Dir, ?OVERVIEW_SUMMARY). - + EncOpts = [{encoding,Encoding}], + edoc_lib:write_file(Text, Dir, ?OVERVIEW_SUMMARY, '', EncOpts). copy_image(Dir) -> case code:priv_dir(?EDOC_APP) of @@ -441,6 +447,12 @@ is_hidden(E) -> _ -> false end. +encoding(E) -> + case get_attrval(encoding, E) of + "latin1" -> latin1; + _ -> utf8 + end. + get_attrval(Name, #xmlElement{attributes = As}) -> case get_attr(Name, As) of [#xmlAttribute{value = V}] -> |