aboutsummaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-04-02 07:40:06 +0200
committerBjörn Gustavsson <[email protected]>2019-04-04 12:30:20 +0200
commit0ed9f0d4cdd2e267ce14f2e4e7aa6286876dbfca (patch)
tree5b6f2b205a6b6c6245467a153aa8ed58a7bedbf9 /make
parent88d9cdc7ba60e3b2c996d5e06a54d92a62b0afc4 (diff)
downloadotp-0ed9f0d4cdd2e267ce14f2e4e7aa6286876dbfca.tar.gz
otp-0ed9f0d4cdd2e267ce14f2e4e7aa6286876dbfca.tar.bz2
otp-0ed9f0d4cdd2e267ce14f2e4e7aa6286876dbfca.zip
emd2exml: Clean emphasis markers in link texts
Our DTD does not allow any nested tags in link texts.
Diffstat (limited to 'make')
-rwxr-xr-xmake/emd2exml.in30
1 files changed, 25 insertions, 5 deletions
diff --git a/make/emd2exml.in b/make/emd2exml.in
index 0d14b961a6..cf53cec155 100755
--- a/make/emd2exml.in
+++ b/make/emd2exml.in
@@ -462,7 +462,7 @@ url([C|Cs], Bool, Acc) ->
url(Cs, Bool, [C|Acc]).
link_or_image(Str, Type) ->
- case link_or_image_text(Str, "") of
+ case link_or_image_text(Str) of
no -> no;
{Text, Cont1} ->
case link_or_image_data(Cont1, none, Type, "", "") of
@@ -495,16 +495,36 @@ internal_seealso("#" ++ Marker) ->
internal_seealso(_) ->
no.
+link_or_image_text(Cs0) ->
+ {Prefix, Cs2} = case Cs0 of
+ "__" ++ Cs1 -> {"__", Cs1};
+ "_" ++ Cs1 -> {"_", Cs1};
+ "**" ++ Cs1 -> {"**", Cs1};
+ "*" ++ Cs1 -> {"*", Cs1};
+ Cs1 -> {"", Cs1}
+ end,
+ {Text0, Cs} = link_or_image_text(Cs2, []),
+ Text = case lists:prefix(Prefix, Text0) of
+ false ->
+ lists:reverse(Text0, Prefix);
+ true ->
+ lists:reverse(lists:nthtail(length(Prefix), Text0))
+ end,
+ case Text of
+ [] ->
+ no;
+ [_|_] ->
+ {Text, Cs}
+ end.
+
link_or_image_text([$\\,C|Cs], Acc) ->
link_or_image_text(Cs, [C|Acc]);
-link_or_image_text([$]|_Cs], "") ->
- no;
link_or_image_text([$]|Cs], Acc) ->
- {lists:reverse(Acc), Cs};
+ {Acc, Cs};
link_or_image_text([C|Cs], Acc) ->
link_or_image_text(Cs, [C|Acc]);
link_or_image_text([], _Acc) ->
- no.
+ {[], []}.
link_or_image_data([C|Cs], none, link, "", "") when C == $ ; C == $\t ->
link_or_image_data(Cs, none, link, "", "");