aboutsummaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-04-02 09:00:35 +0200
committerBjörn Gustavsson <[email protected]>2019-04-04 12:30:20 +0200
commitc927640b4f1d97e6ecbc91ebb9bab159a1ac481f (patch)
tree514d4bf24185a8b06e4d52120b45eade73950791 /make
parent0ed9f0d4cdd2e267ce14f2e4e7aa6286876dbfca (diff)
downloadotp-c927640b4f1d97e6ecbc91ebb9bab159a1ac481f.tar.gz
otp-c927640b4f1d97e6ecbc91ebb9bab159a1ac481f.tar.bz2
otp-c927640b4f1d97e6ecbc91ebb9bab159a1ac481f.zip
emd2exml: Remove paragraphs around image tags
Figure numbering will be messed up if an image tag is inside a paragraph.
Diffstat (limited to 'make')
-rwxr-xr-xmake/emd2exml.in20
1 files changed, 19 insertions, 1 deletions
diff --git a/make/emd2exml.in b/make/emd2exml.in
index cf53cec155..ec3de0a7f8 100755
--- a/make/emd2exml.in
+++ b/make/emd2exml.in
@@ -1238,7 +1238,7 @@ put_delayed(#state{out = Out} = S, Key, Data) ->
S#state{out = [{delayed, Key, Data} | Out]}.
put_chars(#state{out = Out} = S, Chars) ->
- S#state{out = [[Chars] | Out]}.
+ S#state{out = [Chars | Out]}.
put_line(#state{out = Out} = S, String) ->
S#state{out = [[String, nl()] | Out]}.
@@ -1278,9 +1278,27 @@ complete_output(S, [{delayed, Key, {image, _Text, Line}}|Rest], Out) ->
{File, _} = S#state.ifile,
error(File, Line, "Image definition name `~ts' not found~n", [Key])
end;
+complete_output(S, [["</p>","\n"]=ParaStart,
+ Contents,
+ ["<p>","\n"]=ParaEnd|Rest], Out) ->
+ case is_image_tag(Contents) of
+ true ->
+ %% Get rid of the paragraph around an image tag. It would mess up
+ %% figure numbering.
+ complete_output(S, Rest, [Contents|Out]);
+ false ->
+ complete_output(S, [Contents,ParaEnd|Rest], [ParaStart|Out])
+ end;
complete_output(S, [Next|Rest], Out) ->
complete_output(S, Rest, [Next|Out]).
+is_image_tag("<image" ++ _) ->
+ true;
+is_image_tag([[_|_]=H | _]) ->
+ is_image_tag(H);
+is_image_tag(_) ->
+ false.
+
write_output(_OFD, []) ->
ok;
write_output(OFD, [O|Os]) ->