~nytpu/gemroff

52117e228a10d305001bf252b88010dae6684538 — nytpu 29 days ago 5c30a40 master
Rendering.Render_HTML: fix additional bugs with unordered list handling
1 files changed, 9 insertions(+), 6 deletions(-)

M src/gemroff-rendering-render_html.adb
M src/gemroff-rendering-render_html.adb => src/gemroff-rendering-render_html.adb +9 -6
@@ 25,7 25,8 @@ is
	Footnotes_Backup : Stream_Element_Array_Vectors.Vector;

	-- Whether we're inside various block markup now.
	In_Paragraph, In_Preformatted, In_Sequential_List, In_Blockquote, In_Unordered_List, In_Footnote : Boolean := False;
	In_Paragraph, In_Preformatted, In_Blockquote, In_Sequential_List, In_Unordered_List,
		In_Footnote : Boolean := False;

	-- If True then the next inline markup should NOT be separated from the
	-- previous, otherwise it should be separated by a space.


@@ 37,6 38,8 @@ is
	-- Counter of footnotes, so the printed index isn't reset when Flush_Footnotes is called.
	Footnotes_Offset : Stream_Element_Array_Vectors.Extended_Index := 0;

	Previous_Kind : Line_Types := Text;


	------------------
	-- Get_Adjoiner --


@@ 206,16 209,13 @@ begin
			if
				In_Sequential_List and
				not In_Unordered_List and
				Previous_Kind in Unordered_List | Unordered_List_Open | Unordered_List_Close and
				L.Kind not in Unordered_List | Unordered_List_Open | Unordered_List_Close
			then
				In_Sequential_List := False;
				Put_Line(Stream, "</ul>");
			end if;

			if not In_Sequential_List and L.Kind = Unordered_List_Close then
				Put_Line(Stream, "</ul>");
			end if;

			if In_Blockquote and L.Kind /= Blockquote then
				Put_Line(Stream, "</blockquote>");
				In_Blockquote := False;


@@ 303,9 303,10 @@ begin
				when Blockquote_Close => Put_Line(Stream, "</blockquote>");

				when Unordered_List_Open =>
					if not (In_Unordered_List or In_Sequential_List) then
					if not (In_Sequential_List or In_Unordered_List) then
						Put_Line(Stream, "<ul>");
					end if;
					In_Sequential_List := True;
					In_Unordered_List := True;
					Put(Stream, "<li>");



@@ 493,6 494,8 @@ begin
					Direct_Adjoin := False;
			end case;
		end if;

		Previous_Kind := L.Kind;
	end loop;

	if In_Footnote then