aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/src/cover.erl
diff options
context:
space:
mode:
authorTom Moertel <[email protected]>2010-07-09 19:17:09 -0400
committerTom Moertel <[email protected]>2010-07-28 14:55:14 -0400
commitacc2dce9095b4218e1ffaf6da25fbd581f8b1d38 (patch)
treee8f9bb8e3a14eea941781d89d07cee83da96fcdd /lib/tools/src/cover.erl
parent1d484d1c96dd5111c45e656d20b58f1ae5c24f59 (diff)
downloadotp-acc2dce9095b4218e1ffaf6da25fbd581f8b1d38.tar.gz
otp-acc2dce9095b4218e1ffaf6da25fbd581f8b1d38.tar.bz2
otp-acc2dce9095b4218e1ffaf6da25fbd581f8b1d38.zip
Fix cover's HTML-generation logic to escape ampersands in source code
When cover generates HTML files and embeds source code within them, it does not escape ampersands in the source code. These bare ampersands get misinterpreted by web browsers as HTML character-entity references; as a result, source code containing ampersands renders improperly. This small patch fixes the problem by causing bare ampersands to be escaped into as "&amp;" character-entity references.
Diffstat (limited to 'lib/tools/src/cover.erl')
-rw-r--r--lib/tools/src/cover.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl
index 6501e05a6e..c4d1bd1d2f 100644
--- a/lib/tools/src/cover.erl
+++ b/lib/tools/src/cover.erl
@@ -2174,6 +2174,8 @@ escape_lt_and_gt1([$<|T],Acc) ->
escape_lt_and_gt1(T,[$;,$t,$l,$&|Acc]);
escape_lt_and_gt1([$>|T],Acc) ->
escape_lt_and_gt1(T,[$;,$t,$g,$&|Acc]);
+escape_lt_and_gt1([$&|T],Acc) ->
+ escape_lt_and_gt1(T,[$;,$p,$m,$a,$&|Acc]);
escape_lt_and_gt1([],Acc) ->
lists:reverse(Acc);
escape_lt_and_gt1([H|T],Acc) ->