From 4d00aca757265010cae5626c33d186c1cb2c23b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 30 Jan 2021 09:55:26 +0000 Subject: Fix nested lists --- aux/emparse | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'aux/emparse') diff --git a/aux/emparse b/aux/emparse index 929c1c7..5fb9397 100755 --- a/aux/emparse +++ b/aux/emparse @@ -144,6 +144,8 @@ function breakblock() { opendef = 0 openblock = 0 openformat = "" + itemlevel = 1 + delete leveltype expectblock = 1 } @@ -158,9 +160,16 @@ function heading(level, line) { function item(level, type, line) { if (openitem) printf "" openitem = 1 - if (level > itemlevel) printf "<%s>\n", type - if (level < itemlevel) printf "\n", type - itemlevel = level + if (type != "nl") { + for (; itemlevel < level; itemlevel++) { + printf "<%s>\n", type + leveltype[itemlevel+1] = type + } + for (; itemlevel > level; itemlevel--) { + printf "\n", leveltype[itemlevel] + leveltype[itemlevel] = "" + } + } if (type == "ul") { sub("^ +- ", "") printf "
  • " -- cgit v1.2.3